需求:
iTerm2连接服务器时,总是需要输入密码,现在想保存密码直接登录。
安装sshpass
1、下载sshpass
2、进入sshpass目录
3、运行./configure
4、运行sudo make install
5、运行sshpass测试是否安装成功
[@XXX-Pro:sshpass-1.06]$ sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
应用
示例:使用用户名和密码登录服务器
[@X-Pro:sshpass-1.06]$ sshpass -p 'passwd' ssh root@192.168.3.10
集成iTerms
设置界面:
打开Profiles-Open Profiles-Edit Profiles
修改蓝框中的信息即可
image.png
快速打开
image.png