如果你的服务器之间没有认证,你想方便你本地登陆远程服务器,而不用重复输入密码。可以用sshpass来轻松解决这个问题。
下载地址:
[root@puppet sshpass-1.04]# ./sshpass --help
./sshpass: invalid option -- -
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
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
使用简介
[root@puppet sshpass-1.04]# sshpass -f pass ssh
Last login: Tue Jan 12 10:39:54 2010 from 11.11.208.86
[netseek@web109 ~]$ //登陆成功了,很方便。
注:
把 StrictHostKeyChecking no加到/etc/ssh/ssh_config 可以让ssh客户端自动接受新主机的hostkey,不用每次都自己输入yes
传文件
sshpass -p xxx scp COPYING
阅读(2583) | 评论(0) | 转发(0) |