Chapter - 7 Users and Groups
Chapter - 7 Users and Groups
Password: - This field contains the encrypted password of the user account. But if the
shadowing is enabled this file contains only a X which indicates that the user’s password
is stored in /etc/shadow file.
Uid: - The uid field contains the unique user identification number of the user.
Gid: - This field contains the user’s primary group identification number.
Comment:- This is an optional field which contains some comments about the user –
normally his full name.
Directory:- This field contains the path to the user’s home
directory.
User1:g12fyhq:150:150:Accel it academy:/home/user1:/bin/bash
useradd command
# passwd aita
Enter the password:
Confirm the password:
Only root can able to specify a username along with the
passwd command. The other users can use the passwd
command without any argument to change their own
passwd.
usermod command
The usermod command is used to modify the user parameters as follows
As like /etc/passwd file for user accounts, group account information will
be stored in /etc/group file. In this file one line will be available for each
group with colon-separated fields as follows
groupname:passwd:gid:userlist
• Groupname is the name of the group
•Password is an optional field containing the encrypted group
password.
•Gid is the numeric group ID number.
•Uselist is a comma-separated list of the user account names
that comprise the group.
A typical entry in the group file might resemble the following:
aita : x : 510 : manoj, babu, ram
The groupadd command
The groupadd command can be used to create new group
accounts.
# groupadd aita
groupdel groupname
Using Graphical tools
# su – manoj
$
Since you are using su as root it will not ask for the password of the new user.
The groups Command
The groups command will display the names of the
groups where a user is having membership.
# groups
root bin admin daemon sys ….. etc
# groups user1
The above command will display the names of the groups where
the user user1 is having membership.
The id command
This command can be used to get the information
about the uid, gid and supplementary group Ids and group
names of a user account. If you invoke this command
without any argument it will be given details about the
current user.
# id
uid=0(root) gid=0(root) groups=0(root),
1(bin), 2(daemon), 3(sys), ………
# id user1
For getting the uid and gid information of a different user
you can give the user name as an argument to id command
as above.