我想从我的 Windows 运行 sshpass
命令到远程 Linux 服务器。我使用这个命令:
sshpass -p 'password' ssh ldap.nextstep4it.com -l root -o StrictHostKeyChecking=no
但是我的 cmd 返回以下错误语句:
'sshpass' is not recognized as an internal or external command, operable program or batch file.
我认为这是因为 Windows 没有像 Linux 那样的 sshpass
包。在 Linux 中,我必须安装 sshpass
包才能运行此命令。
有人知道如何通过 Windows 命令行运行 sshpass
命令吗?
最佳答案
您不能在 Windows 中运行 sshpass。 但是,您可以通过 Windows 命令行使用 putty 来实现相同的目的。
putty -load "host" -l username -pw password
您还可以使用 WinSCP 通过命令行(使用密码)上传文件
winscp /command "option batch abort" "option confirm off" "open sftp://user:password@example.com/" "put examplefile.txt /home/user/" "exit"
关于linux - Windows 上为 "sshpass is not recognized",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23419659/