Thursday, January 7, 2010

Playing with user's accounts in solaris 10

In the ancient days, Playing with User's account was little Bit tricky. We have to edit shadow and passwd files.
But Now the passwd command emerged with very useful and powerful options in solaris 10.

Let's play with some different and cool options and enjoy... :)

1.) Passwd -s "username" :- show password attributes for his or her own login name.

NL :- Non login {Account Cannot Login}
LK:- Locked Account {Account is locked}
PS:- password Set. {Account's password is set and can login}
NP:- No Password.

eg:-

bash-3.00# passwd -s devender
devender PS

bash-3.00# grep devender /etc/shadow
devender:Hsk0ooacdupFE:14615::::::



bash-3.00# passwd -s daemon
daemon NL

bash-3.00# grep daemon /etc/shadow
daemon:NP:6445::::::


bash-3.00# passwd -s test
test LK

bash-3.00# grep test /etc/shadow
test:*LK*:14616::::::

2.) passwd "username" :- To Unlock an account and to set password.

bash-3.00# passwd test
New Password:
Re-enter new Password:
passwd: password successfully changed for test

bash-3.00# grep test /etc/shadow
test:i.RyiOqQ7UdlM:14616::::::

There is very unique and New Feature in solaris 10 in comparison of old versions i.e it preserves the encrypted password if u lock an account, so that the password of that particular user will remain same while you unlock the account.

eg:-

3.) passwd -l "Username" :- To lock an account..

bash-3.00# passwd -l test
passwd: password information changed for test

bash-3.00# grep test /etc/shadow
test:*LK*i.RyiOqQ7UdlM:14616::::::

4.) passwd -u "Username" :- To unlock an account.

bash-3.00# passwd -u test
passwd: password information changed for test

bash-3.00# grep test /etc/shadow
test:i.RyiOqQ7UdlM:14616::::::

5.) passwd -N "username" :- To make an account non-login account..

bash-3.00# passwd -N test
passwd: password information changed for test

bash-3.00# grep test /etc/shadow
test:NP:14616::::::

Here you can see that encrypted password information has been discarded by the -N option and the account is non-login account Now.




Your suggestions and Comments are Invited...

Enjoy.

3 comments: