下载:wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz
解压:tar xvzf sshpass-1.05.tar.gz
进入目录:cd sshpass-1.05
执行校验:./configure
安装:make&&make install
开始使用 sshpass 吧!
实例1:直接远程连接某台主机:
命令:sshpass -p xxx ssh root@192.168.11.11
实例2:远程连接指定ssh的端口:
命令:sshpass -p 123456 ssh -p 1000 root@192.168.11.11 (当远程主机不是默认的22端口时候)
实例3:从密码文件读取文件内容作为密码去远程连接主机
命令:sshpass -f xxx.txt ssh root@192.168.11.11
实例4:从远程主机上拉取文件到本地
命令: sshpass -p '123456' scp root@host_ip:/home/test/t ./tmp/
Shuttle配置案例
{
"_comments": [
"Valid terminals include: 'Terminal.app' or 'iTerm'",
"In the editor value change 'default' to 'nano', 'vi', or another terminal based editor.",
"Hosts will also be read from your ~/.ssh/config or /etc/ssh_config file, if available",
"For more information on how to configure, please see http://fitztrev.github.io/shuttle/"
],
"editor": "default",
"launch_at_login": false,
"terminal": "Terminal.app",
"iTerm_version": "nightly",
"default_theme": "Homebrew",
"open_in": "new",
"show_ssh_config_hosts": false,
"ssh_config_ignore_hosts": [ ],
"ssh_config_ignore_keywords": [ ],
"hosts": [
{
"cmd": "ps aux | grep defaults",
"name": "打开终端"
},
{
"测试环境": [
{
"cmd": "sshpass -p 'my_pass' ssh -o StrictHostKeyChecking=no -p 22 root@10.10.10.10",
"name": "跳板机"
}
]
}
]
}