Linux background development of the students know, under Windows has xshell\securecrt such excellent SSH client software. Mac looked under, there are SecureCRT Mac version, the internet has cracked, trial for a while, a problem has not been able to solve--ssh link occasionally will be broken off. about this problem, first say Leby work environment: we are not directly SSH target host, must use SSH proxy, so set up an HTTP proxy, which before Windows Xshell work very well. In the scrt of Mac, always randomly drop the line, some time-out configuration is certainly tried, does not solve the problem.
Check the HTTP proxy log, found under Windows Xshell is HTTP1.1, Mac Scrt sent over the request is HTTP1.0. HTTP1.1 support KeepAlive, is it a question of 1.0 short links?
OK,Corkscrew is a shell can ssh proxy software, corkscrew is only support HTTP forwarding, can also use other ss5 and so on. Through this connection HTTP proxy access to the host, or HTTP1.0, corkscrew is open source, so modified the source code for HTTP1.1 and host header settings, the result is not.
Corkscrew corresponding ~/.ssh/config configuration is as follows
Host 10.*.*.* 192.*.*.* 172.16.*.* #ProxyCommand corkscrew HTTP proxy ip HTTP proxy port%h%p ~/.corkscrew-authproxycommand/ Usr/local/bin/corkscrew "Your IP" 8080%h%pserveraliveinterval 120ConnectTimeout 240
Further, the HTTP proxy for the SOCK5 agent, the problem is still, later think, broken chain off the line is random, should really have no relationship with the agent. Perhaps really is the Mac under the SecureCRT existence drops the phenomenon.
Leby use a period of time to iterm2 it first.
Iterm2 itself does not support the SSH proxy client, or need to use corkscrew to relay, corkscrew this part of the configuration can be reused, that is, the first guarantee under the terminal can
SSH [email protected] connects to the remote host, so you can use the command to log in without using the local shell in the Iterm2 profile configuration. But the problem is that the password cannot be saved, at this time Leby know there are two scenarios, one is to use the Sshpass password plaintext transmission, but the first time you log in need to save the key. Another is the use of expect, expect script will not be able to avoid entering the password, OK, we prepare a generic ssh expect script:
#!/usr/bin/expect--if{[Llength $argv] <4} {puts"Usage: $ARGV 0 IP Port user passwd"Exit1}match_max600000set IP [lindex $argv0]set Port [lindex $argv1]set User [lindex $argv2]setpasswd[Lindex $argv3]set Yesnoflag0Set Timeout-1SpawnSSH-q-l$user-p$port $ipexpect {"Assword:"{Send"$passwd \ r" } "yes/no)?"{Set Yesnoflag1Send"yes\r" } "FATAL"{puts"\nconnect Error: $IP occur FATAL error!!! \ n"Exit1 } "No route to host"{puts"\nconnect ERROR: $ip No route to host!!! \ n"Exit1 }}}if{$yesnoflag = =1} {expect {"Assword:"{Send"$passwd \ r" } "yes/no)?"{Set Yesnoflag2Send"yes\r" } }}if{$yesnoflag = =2} {expect {"Assword:"{Send"$passwd \ r"}}}puts"\ n--------> Connected: $ip, pls enjoy yourself!\n"Interact
So you can use this in the terminal, or fill in the Profiles command in Iterm2:
Expect ~/works/ssh/ssh127.0. 0.1 2222 Root lebypasswd
fix Proxy,profile, still poor rz\sz. This is relatively simple, first install
Install Lrzsz
Or you can download the lrzsz-0.12.20.tar.gz yourself and compile the installation.
Again in Iterm2 session, configure the trigger, advanced configuration of the trigger inside:
Regular expression: \*\*b0100 action:run Silent coprocess Parameters:/usr/local/bin/iterm2-send-zmodem.shregular Expression: \*\*b00000000000000 action:run Silent coprocess Parameters:/usr/local/bin/iterm2-recv-zmodem.sh
Notice here that the trigger corresponds to two scripts that can be downloaded from here: Https://github.com/mmastrac/iterm2-zmodem, these two scripts are also a lot of online.
It is then placed under/usr/local/bin/and can be tested at this point. If there is a problem, please check the relevant trigger configuration, script, RZ SZ command line path is correct.
About Iterm2, finally reconfigure the favorite solized theme, well, now look at everything is good!
About configuration such as SSH client Iterm2 under Mac