Use Iterm2 quick connection SSH (HTTP proxy)

1, the configuration iterm2> Preferences ..> Profiles> Fill: name: Alias; the Command: Expect / the Users / jerryxu / wwwroot / Cache / bin / ssh_jwy

2, / Users / jerryxu / wwwroot / cache / bin / ssh_jwy follows:

#!/usr/bin/expect -f
set port <port>
set user <user>
set host <ip>
set password <pass>
set timeout -1

spawn ssh -p $port $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
  • user username
  • pass Password
  • port port
  • ip ip or domain name server

3, right iterm2 new tab / new window opens alias connection. carry out; 

It is only applicable to the above configuration using mac; Please use by other systems, such as their configuration can be changed accordingly; 

When we want to use the best network HTTP proxy to connect ssh:

First install  corkscrew  

brew install corkscrew

And then view the corkscrew position:

which corkscrew

After obtaining the corkscrew Path. Such as: / usr / local / bin / corkscrew

And then modify the Command configuration file: / Users / jerryxu / wwwroot / cache / bin / ssh_jwy

#!/usr/bin/expect -f
set port <port>
set user <user>
set host <ip>
set password <pass>
set timeout -1

spawn ssh -v -o "ProxyCommand /usr/local/bin/corkscrew 127.0.0.1 8001 %h %p" -p $port $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
  • Proxy server ip 127.0.0.1
  • 8001 proxy server port

Such as HTTP proxy server have an account and password, please change 

ProxyCommand /usr/local/bin/corkscrew 127.0.0.1 8001 %h %p ~/.ssh/proxyauth

~ / .Ssh / proxyauth says:

username:password

 

Extended:

How to build http server

 

Guess you like

Origin www.cnblogs.com/q1104460935/p/11830620.html