问题描述
我知道我们应该这样做ssh 用户@目标但是我们在哪里指定密码?
I know that we shuld dossh user@targetbut where do we specify the password ?
嗯,感谢您的所有回复.我的要求是我必须在不同的机器上启动一些服务器.所有服务器都应使用一个 shell 脚本启动.好吧,每次输入密码似乎没什么坏处,但我想我将不得不求助于该选项.我不想保存公钥的一个原因是我可能不会每次都连接到同一台机器.返回并修改脚本以更改目标地址很容易.
Hmm thanks for all your replies.My requirement is I have to start up some servers on different machines. All servers should be started with one shell script. Well, entering password every time seems little bad but I guess I will have to resort to that option. One reason why I don't want to save the public keys is I may not connect to same machines every time. It is easy to go back and modify the script to change target addresses though.
推荐答案
出于安全原因,这不能通过简单的 ssh 命令完成.如果您想通过 ssh 使用密码路由,如果您坚持,以下链接显示了一些脚本来解决这个问题:
This cannot be done with a simple ssh command, for security reasons. If you want to use the password route with ssh, the following link shows some scripts to get around this, if you are insistent:
这篇关于如何在shell脚本中使用ssh命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!