Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

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.

share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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