简体   繁体   English

使用root的SSH密码脚本

[英]SSH password script using root

Hello I am trying to work on a SSH password script. 您好,我正在尝试使用SSH密码脚本。

The user I am using is root because this is for a cluster of servers and the root user has password less entry to all of the other servers in the cluster. 我正在使用的用户是root用户,因为这是针对服务器群集的,而root用户的密码较少,无法进入群集中的所有其他服务器。

What I have here works as on one server 我在这里拥有的就像在一台服务器上一样

echo "Welcome3 | passwd user1 --stdin"

This is the script i'm trying to user on the cluster. 这是我尝试在群集上使用的脚本。

export HOSTS="server1.server.com
server2.server.com
server3.server.com
server4.server.com
server5.server.com"

for i in $HOSTS
do
echo $i
ssh $i echo Welcome3 | passwd user1 --stdin
done

I get the message 我收到消息

"servername changing password for user user1 passwd: all authentication tokens updated successfully" “更改用户user1 passwd的服务器名的密码:所有身份验证令牌已成功更新”

But when I go to login to the other servers with the new password it dose not seem to take. 但是,当我使用新密码登录其他服务器时,似乎没有用。

Any thoughts would be appreciated. 任何想法将不胜感激。

Thanks in advance. 提前致谢。

You changed the password of user1 on your local machine. 您在本地计算机上更改了user1的密码。

Try this: 尝试这个:

ssh $i 'echo Welcome3 | passwd user1 --stdin'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM