Ubuntu – How to change password using usermod

password

I am superadmin of a server and like to change password of an existing user . How can I do that ?

I tried

usermod -p 'new-password' john

but it didn't worked ?

Best Answer

  • The usermod -p flag is expecting the data to be the password already in an encrypted format.

    Use openssl passwd to generate the encrypted data, or do it like this:

    usermod -p `openssl passwd` (USERNAME)