Monday, April 7, 2008

Locking User Accounts

Locking Linux user account
passwd -l {user-name}

-l : This option disables an account by changing the password to a value, which matches no possible encrypted value.

For unlocking the account use:
passwd -u {user-name}

Locking FreeBSD user account
pw lock {username}

unlocking
pw unlock {username}

Locking Solaris UNIX user account
passwd -l {username}

Locking HP-UX user account
passwd -l {username}

For unlocking the HP-UX account you need to edit /etc/passwd file using text editor
vi /etc/passwd

Finding out accounts without password.

Linux display password status
passwd -S {user-name}

Where,
-S : Display account status information. The status information consists of total seven fields. The second field indicates the status of password using following format:
L : if the user account is locked (L)
NP : Account has no password (NP)
P: Account has a usable password (P)

Solaris UNIX display password status
passwd -s {user-name}Where,
-s : Display account status information using following format:
PS : Account has a usable password
LK : User account is locked
NP : Account has no password