Thursday, January 24, 2008

Disabling User Accounts in Linux

In linux the users can be disabled from accessing their shells temporarily by one of these methods

1.The linux store the encrypted passwords of the users in /etc/shadow file.
By replacing the encrypted password (second field) with * or !, the user cannot login.

2.By using the passwd command the super user can lock the account
passwd username -l
This will add a "!" infront of the encrypted password in /etc/shadow file
To unlock the account,
passwd username -u can be used.
This will remove the "!". This can be done manually too

3.By using chpass command the default shell can be changed to /sbin/nologin
chpass -s /sbin/nologin {username}

No comments: