How do I disable and change the user password using SSH on a Linux


Login with the root account, and type: passwd otheraccount hit enter. replace otheraccount with the account name of the user you want to have the password changed.


You don't. You perform the actions on the underlying system user via passwd.

  • right, once I login as admin, how do I go about doing it? – Jean Oct 5 '10 at 7:54
  • With the passwd command. See the passwd(1) man page for details. – Ignacio Vazquez-Abrams Oct 5 '10 at 7:55
  • not for the user login but for an alternate user – Jean Oct 5 '10 at 7:58
  • As the man page says, you can specify an alternate user for passwd to use. – Ignacio Vazquez-Abrams Oct 5 '10 at 7:59

You have a few options, somewhat dependent on what you mean by "disable". For the purposes of this explanation I will use the string foo as a placeholder for the account name in question.

You cannot disable an account, per se, without deleting it wholesale, however, deactivating the account password passwd --inactive 0 foo will effect a similar functional change.

The closest to what I believe to be your objective would be to lock the account, passwd -l foo which changes the password to an unknown, encrypted value.

Another option, although not immediately apparent perhaps, is to delete the account. This will likely be performed with the userdel foo command, depending on your particular operating system. userdel will, by default, not delete any files owned by the user but will remove the account itself from the system account files. Be careful when exercising this option, however, as it can adversely affect cron execution and other automated processes if execution normally occurs as the deleted user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.