0

In a shell script with sudo privileges, I'm trying to change another users password.

I tried sudo passwd username but didn't get anywhere.

american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80

1 Answers1

2

You need to use the chpasswd command. You can try something like this:

echo "username:password" | sudo chpasswd

I used it many times. It worked for me.

Nurjan
  • 5,889
  • 5
  • 34
  • 54