iTerm2 免密登录 SSH 的方法
大家都知道使用iTerm2连接shh 使用命令 ssh -p22 root@129.10.10.1,然后输入密码即可。但是对于我们的服务器或者测试服务器,每次都这么手动ssh连接太慢了而且麻烦,我们可以考虑使用比较快捷的方式去连接的。
1、在~/.ssh下,新建文件,比如login,或者test1等;
2、
1 |
|
3、如果是其他的端口,在set一个port xxxx,xxxx对应你的端口;
4、打开iterm2的Profiles,点击+号,新增一个profile,name写自己连接主机的名称,然后在command上选择command,把:
1 | expect ~/.ssh/login |
后面的login对应你建立的文件名称
5、使用的时候,直接在iterm2上面的Profiles选择你填写的用户名即可。
如果觉得我的文章对您有用,请随意打赏。
感谢您的阅读,本文由 李经纶 版权所有。如若转载,请注明出处:李经纶个人博客(https://lijinglun.com/2018/04/27/登录/)