0% found this document useful (0 votes)
92 views5 pages

Linux User and Group Management Guide

There are 5 types of users in Linux: system users, normal users, system users, network users, and sudo users. The /etc/passwd file contains username, password information, user ID, group ID, and other fields for each user. Users can be created using the useradd, adduser, and newusers commands. The usermod command is used to modify user attributes, and userdel deletes users. Sudo users allow specific users to run commands as root without entering the root password. User and group permissions control access to files and resources in Linux.

Uploaded by

Nihal Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views5 pages

Linux User and Group Management Guide

There are 5 types of users in Linux: system users, normal users, system users, network users, and sudo users. The /etc/passwd file contains username, password information, user ID, group ID, and other fields for each user. Users can be created using the useradd, adduser, and newusers commands. The usermod command is used to modify user attributes, and userdel deletes users. Sudo users allow specific users to run commands as root without entering the root password. User and group permissions control access to files and resources in Linux.

Uploaded by

Nihal Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

User and Group Administration

1. How many types of users are available in Linux?

There are 5 types of users available in Linux.


(i) System user (Admin user who control the whole system nothing but root user).
(ii) Normal user (Created by the Super user. In RHEL - 7 the user id's from 1000 - 60000).
(iii) System user (Created when application or software installed ).
(iv) Network user (Nothing but remote user, ie., who are login to the system trough network created in Windows
Active Directory or in Linux LDAP or NIS).
(v) Sudo user (The normal users who are having admin or Super user privileges)

1. What are the important points related to users?


Users and groups are used to control access to files and resources.
Every file on the system is owned by a user and associated with a group.
Every process has an owner and group affiliation.
Every user in the system is assigned a unique user id (uid) and group id (gid).
Users cannot read, write and execute each other's files without permission

2. What are the fields available in /etc/passwd file?


<username> : x : <uid> : <gid> : <comment> : <home> : <shell>
(x menas link to /etc/shadow file)
3. In how many ways can we create the users?
(i) # useradd -
(ii) # adduser -
(iii) # newusers (In this file we have to enter the user details same as /etc/passwd file)

4. What is the syntax ofuseradd command with full options?


# useradd -u <uid> -g <gid> -G <secondary group> -c <comment> -d <home directory > -s <shell> <usernmae>

Example : # useradd -u 600 -g 600 -G dev_team -c "ahbijit zarkar" -d /home/abhijit -s /bin/bash abhijit

5. What is the syntax of userdel command with full options?


# userdel
The options are,
-f -----> forcefully delete the user even through the user is login. The user's home directory, mail and message
directories are also deleted.
-r -----> recursively means files in the user's home directory will be deleted and his home directory also deleted
but the other files belongs to that user should be deleted manually.

6. How to check whether user is already created or not?


(i) # id (It shows the user id group id and user name if that is already created)
(ii) # grep /etc/passwd

7. What is syntax of the usermod command with full options?


-L -----> lock the password
-U -----> unlock the password
-o ----->creates duplicate user modify the user's id same as other user
-u ----->modify user id
-g -----> modify group id
-G -----> modify or add the secondary group
-c -----> modify comment
-d -----> modify home directory
-s -----> modify user's login shell
-l -----> modify user's login name
-md ----> modify the users home directory and the old home directory.

8. What is a group?
The collection of users is called a group. There are two types of groups.
Primary group : It will be created automatically whenever the user is created. User belongs to on group is called
as primary group.
Secondary group : It will not create automatically. The admin user should be created manually and users
belongs to more than one group is called secondary group. A user can be assigned to max. 16 groups. ie., 1
primary group and 15 secondary groups.
9. Explain the sudo user?
Sudoers (nothing but sudo users) allows particular users to run various root user commands without needing a
root password.
/etc/sudoers is the configuration file for sudoers to configure the normal user as privileged user.

10. How to give different sudo permissions to normal users?


Open the /etc/sudoers file by executing
#visudo
<username> <machine> <command>
root ALL=(ALL) ALL
raju ALL=(ALL) ALL

----Save and exit this file.

* Instead of giving all permissions to normal user we can give only some commands.

raju ALL=NOPASSWD:/usr/sbin/useradd, /usr/sbin/usermod, /usr/sbin/mkdir

For specific user


jayanthi ALL=(ALL) NOPASSWD:/bin/su - azhar

11. In which location the sudo user commands history is logged?

All the sudo users commands history is logged in /var/log/secure file to make a record of sudo user commands.
# cat /var/log/secure or /var/log/auth.log
# tailf /var/log/secure or /var/log/auth.log

12. The other useful commands :

# w (this command gives the login user information like how many users currently login and full
information )
# who (to see users who are currently login and on which terminal they login)
# last (see the list of users who are login and logout since the /var/log/wtmp file was created)
# lastb (to see the list of the users who tried as bad logins)
# lastreboot (to see all reboots since the log file was created)
# uptime (to see the information from how long the system is running, how many users login and load
average)
* The load average is from 1 sec : 5 secs : 15 secs
# df (to see the mounted partitions, their mount points and amount of disk space)
# du (to see the disk usage of the each file in bytes)
# uname -r (gives the current kernel version)
# last -x (It shows last shutdown date and time)
# last -x grep shutdown (only shutdown time shows ie., grep will filter the 'last -x' command)
* grep: It is used to search a word or sentence in file (ie., inside the file)
* find : It is used to search a command or file inside the system)

13. How many types of the files are there?


There are 7 types of files.
1. - -----> regular file
2. d -----> directory
3. c -----> character device file (Ex. console file, open and close terminals, ...etc.,)
4. b -----> block device file (Ex. device blocks like hard disks, CD/DVD disks)
5. s -----> socket file (programmers will deal this file)
6. p -----> pipe file (programmers will deal this file)
7. l -----> linked file (nothing but short cut file)

14. What are permission types available in Linux and their numeric representations?
There are mainly three types of permissions available in Linux and those are,
read
write
execute
null permission ------ 0

4: Read permission (r)


2: Write permission (w)
1: Execute permission (x):

15. What are the default permissions of a file and directory?

The default file permission for a newly created file is 0664 or -rw-rw-r--.
The default directory permission for a newly created directory is 0775 or drwxrwxr-x.

16.What is umask in linux?


The user file-creation mode mask (umask) is used to determine the file permissions for newly created
files or directories. It can be used to control the default file or directory permissions for new files. It is a
four-digit octal number. The umask value for normal user is 0002 and the umask value for root user is
0022.

he effected file permissions for normal users = 6 6 6 - 0 0 2 = 6 6 4.


The effected directory permissions for normal users = 7 7 7 - 0 0 2 = 7 7 5.

17. How change the permissions using numeric representation?


The values for read = 4, write = 2, execute = 1 and null = 0. The total value = 4 + 2 + 1 = 7
# chmod Example :
# chmod 7 7 4 file1 (to give read, write and execute to owner and read, write and execute to group and
read permission to others)
# chmod 6 6 0 file2 (to give read and write to owner and read and write to group and null (0) permission
to others)

You might also like