【发布时间】:2017-03-31 14:31:17
【问题描述】:
是否可以将密码提示警报重定向到文件或使其静音?
[lnx51 ~]$ ssh root@192.168.1.1
root@192.168.1.1's password:
【问题讨论】:
-
您是否想要不询问密码并计划使用 id_rsa 或类似的东西?还是您要求自动输入密码?
是否可以将密码提示警报重定向到文件或使其静音?
[lnx51 ~]$ ssh root@192.168.1.1
root@192.168.1.1's password:
【问题讨论】:
为了避免密码验证,你可以使用下一句:
ssh -o PasswordAuthentication=no root@192.168.1.1
这会禁用“手动”身份验证,但您需要另一种方法来登录,否则您将收到如下错误:
Permission denied (publickey,password).
也许你的 id_rsa 有问题
如果你想与 rsync 一起使用(作为你的例子),你必须把命令加上引号(“):
rsync -v -r -l -e "ssh -o PasswordAuthentication=no" ctxt root@192.168.6.2:/home/
你可以在here查看rsync选项
【讨论】:
[lnx5 ~]$ rsync -v -r -l -e ssh -o PasswordAuthentication=no ctxt root@192.168.6.2:/home/ root@192.168.6.2's password:
如果您通过 rsync 运行,请使用批处理模式来防止 ssh 提示输入密码等。 (我假设您将设置基于密码的身份验证)
ssh -o BatchMode=yes root@hostname command
【讨论】:
lnx~#rsync -v -r -l -e ssh -o BatchMode =yes -i /root/ssh/id_rsa -y -y samp.txt root@10.1.13.1:/home/ root@10.1.13.1's password: