Im trying to change the password to a non-root account on a single line (so that I can use it in Ansible). I've just been having trouble getting it to work on my Ubuntu servers.
None of the below commands I found on other stack posts helped.
echo "adminSrv:newPass123)0!$" | chpasswdecho -e "'newPass123)0!$'\n'newPass123)0!$'" | passwd adminSrv
Unable to use the below command since my user doesn't have sudo rights
echo 'user:passwd' | sudo chpasswd
Below are the two variations of the error I keep getting:
Changing password for adminSrv.chpasswd: (user adminSrv) pam_chauthtok() failed, error:Authentication token manipulation errorchpasswd: (line 1, user adminSrv) password not changed
Changing password for adminSrv.Current password: passwd: Authentication token manipulation errorpasswd: password unchanged
I don't get any of those errors if I change my password manually though. But I'd really like to do it on one line. Am I possibly running into a formatting issue? But that's why I included the quotes in my attempts. Thanks for looking.