远程更改Raspberry Pi密码

时间:2019-06-28 19:00:30

标签: linux ssh scripting putty plink

我们正在部署数百个Raspberry Pi,我的任务是编写一个脚本以连接到每个树莓派并执行一些基本的维护任务。

使用腻子“ plink.exe”

我有一个脚本,该脚本将与从计算机列表中拉出的每台计算机建立连接。然后,它针对每个设备执行一个脚本(从脚本文件中提取)。

这对于执行诸如执行几个命令或重新启动设备之类的简单操作非常有效。

我需要做的一件事是定期更改Raspberry Pis上的帐户密码。这就是我卡住的地方。

已执行命令

'C:\Program Files\Putty\plink.exe'  -batch -ssh   test@192.168.1.25 -pw test123  -m C:\temp\changepasswordscript.txt

“ changepasswordscript.txt”的内容

echo -e "test123\n123testees\n123testees" | sudo passwd test

响应:

Command:  & 'C:\Program Files\Putty\plink.exe'  -batch -ssh   test@192.168.1.25 -pw test123  -m C:\temp\changepasswordscript.txt
Enter new UNIX password: Retype new UNIX password: Sorry, passwords do not match
passwd: Authentication token manipulation error
passwd: password unchanged

有人以这种方式成功地对Raspberry Pi(或Linux)执行了远程更改密码脚本吗?

在此先感谢您的帮助。

0 个答案:

没有答案