Wednesday, October 5, 2011

How to manage users accounts in Linux?



Adding user with graphical utility


Show the properties of tony user
[root@pc1  disk]# id tony
Uid=501 (tony)  qid=501 (tony)  qroup=501 (tony)

Add tow uses john and jhosen with different command with default properties
[root@pc1  disk]# adduser  john
[root@pc1  disk]# useradd  umer
 


Assigning password to john
[root@pc1  disk]#  passwd  john

Add a group
[root@pc1  disk]# groupadd cisco

Customizing users properties at the time of creating user
[-u uid ] [-g primary group] [-G secondary group] [ -c comments] [ -d home directory path ] [-s login shell ]
[root@pc1  disk]# usersadd  -u  600  -g  cisco  -G  saad  -c  "Manager"  -d  /etc/jonny  -d /bin/sh jonny

Modify user properties with usermod command
[root@pc1  disk]# usemod  -u 666  -s /bin/bash  jonny

Delete a user jonny with his home directory
[root@pc1  disk]#  userdel -r  jonny

Delete a group cisco
[root@pc1  disk]#  qroupdel  cisco

All users information stored in /etc/passwd every user have a seven column line in this file
1-user name [ user authenticate at the time of login from the first column of /etc/passwd ]
2-password required [ x means users must required password if remove this x user can login without password]

3-uid [ 500 first user id 0 to 499 id's are reserved 0 for root user and remaining for services users ]
4-gid [ every user relate with any group which stored in /etc/group ]
5-comments [full name but it is not compulsory only for information ]
6-home directory path [ linux file system is read only for normal user only his home directory is with full
permission for normal user
7-login shell (/bin/bash, /bin/sh, /bin/tsh, /sbin/nologin) every user required a shell for login without shell user can never login at machine.


[root@pc1  disk]#  gedit /etc/passwd

All groups stored in this file
[root@pc1  disk]#  edit /etc/shadow

User password stored in this file
[root@pc1  disk]#  gedit  /etc/group


Free Linux Help Line


[root@pc1  disk]#  man  mkdir

[root@pc1  disk]#  info mkdir

[root@pc1  disk]# whatis  mkdir

[root@pc1  disk]#  mkdir  - - help

[root@pc1  disk]#  apropos  "partition"

 


No comments: