Skip to content

Disable and enable users from the command line in Ubuntu

2010/06/24

It is easy to disable and enable users from the command line if the version of the passwd utility on your system supports the -l and -u flags. You can verify whether or not they are supported on your system using the command

$ man passwd

to open the manual page for the passwd command. Then, use the search command to find the patterns -l /-l and -u. If you find a description of the lock and unlock options, the following command should effectively disable the user.

sudo passwd -l [user_name]
e.g.
sudo passwd -l training

Enabling users
To re-enable a disabled user, issue the passwd command with the -u option;
sudo passwd -u [username]
e.g.
sudo passwd -u training

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: