1

Here's my current predicament: I need to change the password to a user account on 2000 devices running Ubuntu 16.04. I want to do this remotely via Plink rather than SSH. On all these appliances, the username is TESTUSER and password is TESTPASS. In short, they all have the same username and password.

Plink script executed via CMD: FOR /F "tokens=1,2* delims=," %G IN (C:\Users\username\Desktop\TEST\Device_IPs.txt) DO echo y | plink -v -ssh -m "C:\Users\username\Desktop\TEST\commands.txt" TESTUSER@%G -pw TESTPASS >> Results.txt 2>&1

In my commands.txt file is echo TESTUSER:TESTPASSNEW | chpasswd

The above command works via SSH flawlessly but only with elevated sudo privileges. In other words:

  1. SSH to device
  2. sudo -i
  3. Input TESTPASS as password
  4. Run echo TESTUSER:TESTPASSNEW | chpasswd

TESTPASSNEW is what I'd like to change the password to. Any suggestions are appreciated!

DJPaul
  • 11

0 Answers0