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
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.