Sunday, 1 May 2011

assign a password to a user

# useradd -d /export/home/sita -m sita
# passwd sita
new password: sun
re-enter new password: sun

note:
1. when you assign a password to file by default one file updated  /etc/shadow
to dispaly this file
ex:
# cat /etc/shadow
sita:5znvn4yaDbzck:15065

2. the password file in shadow file is in encrypted format whose length is 13 characters.

Password status:
the user password in 3 different states
1. LK (lock mode)
2. PS (password status mode)
3. NO (no password mode)

check the status of the password:
# passwd -s sita
sita PS                               // PS - password status

Delete the password:
# passwd -d sita               // d- delete


if you check the status now it will be NP(no pwd)
# passwd -s sita
sita NP


if password is not assigned defaultly it takes LK(lock)
# passwd -s jack 
jack LK

to lock password:
# passwd -l sita

to unlock password:
# passwd -u sita

Group & user modification:
1. to modify a group ID:
# groupmod -g <new gid> <groupname>

2. to modify a group name:
# groupmod -n <new name> <old name>

3. to delete a group
# groupdel <groupname>

4. to modify user Id
# usermod -u <uid> <user name>

5. to change the primary group name
# usermod -g <group name> <user name>

6. to change the secondary group name
# usermod -G <group name> <user name>

7. to change user name
# usermod -l <new name> <old name>

8. to delete the user:
# userdel <user name>

9. to delete user name along with id:
# userdel -r <username>

No comments:

Post a Comment