Mac, use Sshpass to let Iterm2 support multiple SSH login information to save
There's a xshell in windows that's very handy because it keeps all your SSH login information. Mac does not have Xshell, some also provide such a function, but the effect is not good. Iterm2 is a very good terminal, but not very good support for many profiles, when the machine to manage more, it is more troublesome. Fortunately it has profiles settings, just can't save SSH login account and password, it also provides the ability to execute external command when loading profiles, so this can use Sshpass to help it execute.
Installing Iterm2
Directly to the official website to download the installation: Http://iterm2.com/,mac software, is a very easy thing
Installing Sshpass
Download: http://sourceforge.net/projects/sshpass/files/
After decompression, enter the Sshpass directory, perform the installation
./configuremakemake Install
In theory, there will be no problem, after the installation, execute the command check whether it is OK
Sshpass-h
Prepare password
Let Sshpass use SSH password, need to save the password in a file, and then Sshpass read the file to get the password, ITERM2 can be through such a command to log on to the host, password file is very simple, take a good name, the password written in it, there is nothing else, such as, In the user directory of the Sshpass directory to build a file called Pass, which is written on the host password: 123456, the file address is:/users/User name/sshpass/pass
Configure Iterm2
Open the Profiles option for Iterm
Add a new profile, the other is not well-configured, mainly in the General command to choose to use command, commands are sshpass execution commands, such as:
/usr/local/bin/sshpass-f/users/Your name/sshpass/pass ssh-p 18018 [email protected]
/usr/local/bin/sshpass is the path to the Sshpass execution file, and if installed by default, it will definitely appear in this location
-F is to tell Sshpass to load the file
/users/fuwy/sshpass/pass is the file to be loaded, that is, the previously built password file
ssh-p18018 [email protected] is said to use SSH link, port 18018,root account number and IP address
After saving, select the profile, you can actually SSH login. Just if it is the first time the machine is logged in, it will not succeed, because SSH login needs you to confirm, will write files to the hosts, so the first time will be directly failed, again or first in the terminal with SSH [email protected] to log in once, it can be.
This allows you to create a new profile and manage logins.
Iterm2 and Xshell still have a lot of not good places, for example, can not directly see the host IP, sometimes want to copy inconvenient. The name on the tab cannot be customized, and after a few more openings, it is not very well differentiated and so on. But there is always better than nothing, so, still good.
Original address: http://youlanglang.com/macxia-shi-yong-sshpassrang-iterm2zhi-chi-duo-sshdeng-lu-xin-xi-bao-cun/
? This article was created by Yu Ronglang. may be freely reproduced, quoted, but must be signed by the author and indicate the source of the article.
Mac, use Sshpass to let Iterm2 support multiple SSH login information to save