Objective:
I encountered several instances of SSH execution failure during the scripting process, all resolved with the-t option. Now write it and share it with you.
Scenario 1
Scripting requires local delivery of positional variables for use by remote servers, but the parameters are always passed, and then successfully delivered after the-t option is added behind
(1) Original script
Ssh-p 1024x768 122.224.xxx.xxx "cd/streams/&& md5sum $2* >>/hzdata/filelist/$1.lst && Exit"
(2) Current script
SSH-T-P 1024x768 122.224.xxx.xxx "cd/streams/&& md5sum $2* >>/hzdata/filelist/$1.lst && Exit"
Scenario 2
Because the key authentication between the two servers, the key verification is done, but because the host information changed, in the know_hosts file needs to be re-recorded, because there are too many servers, so you need to do a script, only need to execute SSH-P IP, but the original script execution will be error, as follows, the plus-t option is normal. The script means to execute the script in a server, log on to the B server, then ssh-p the IP, record a server host information, manually perform exit B server, and then &&exit exit to a server, update know_hosts file completion. 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/83/50/wKioL1dwp-CRzjX_AAAO5JHUQs0318.png "title=" Sogou 20160627121252.png "alt=" Wkiol1dwp-crzjx_aaao5jhuqs0318.png "/>
(1) Original script
Ssh-p 1024x768 $i "ssh-p 1.202.197.87 && Exit"
(2) Current script
SSH-T-P 1024x768 $i "ssh-p 1024x768 1.202.197.87 && Exit"
This article is from the "Court of the Odd Tree" blog, please be sure to keep this source http://zhangdl.blog.51cto.com/11050780/1793226
SSH Virtual Terminal application Example