Home »
Aptitude Questions and Answers »
Linux Aptitude Questions and Answers
Linux User and Group Commands Aptitude Questions and Answers
Linux User and Group Commands Aptitude Questions and Answers: This section contains aptitude questions and answers on Linux User and Group Commands.
Submitted by Nidhi, on May 20, 2020
This section contains Aptitude Questions and Answers on Linux User and Group Commands.
1) Which of the following commands is used to create a new user in the Linux operating system?
- createuser
- adduser
- useradd
- user
Correct answer: 3
useradd
The useradd command is used to create a new user in the Linux operating system.
2) What operations are performed when a new user is created?
- Creates a new home directory for the user
- The ownership and permissions are assigned to the home directory
- Both of the above
- None of the above
Correct answer: 3
Both of the above
When we create a new user then a new home directory gets created with required ownership and permissions.
3) Which of the files gets edited when we create a new in Linux operating system?
- /etc/group
- /etc/shadow
- /etc/gshadow
- /etc/passwd
Options:
- A and B
- C and D
- A, B, and C
- A, B, C, and D
Correct answer: 4
A, B, C, and D
All given files get edited when we create a new in Linux operating system.
4) What is the default UID of root user in the Linux operating system?
- 0
- 1
- 2
- 3
Correct answer: 1
0
The 0 UID is reserved for root users in Linux operating system.
5) What is the range of UIDs is reserved for groups and system accounts?
- 1-50
- 51-100
- 100-999
- 1000-9999
Correct answer: 3
100-999
The UIDs range 100-999 and are reserved for groups and system accounts.
6) There are the following statements that are given below, which of them are correct about GID in the Linux operating system?
- GID is a group identification number that is used it identify a group in Linux OS.
- GID is provided by the Linux operating system to the newly created group.
- GID is provided by the user who created the group in the Linux operating system.
- GIDs are stored in /etc/group file.
Options:
- A and B
- A, B, and D
- A, B, and C
- B, C, and D
Correct answer: 2
A, B, and D
Statements A, B, and D are correct about GID in the Linux operating system.
7) Which exact command is used to create a user with a specified name for the home directory, here we will create a user with user1 name and name of the home directory will be MyHome?
- useradd -m /MyHome user1
- useradd -m -d /MyHome user1
- useradd -m -h /MyHome user1
- useraddhome /MyHome user1
Correct answer: 2
useradd -m -d /MyHome user1
The 2nd option is an exact command to create a user user1 with home directory MyHome.
8) Which Linux command is used to assign a password to the created user?
- password
- newpass
- passwd
- pwd
Correct answer: 3
passwd
The passwd command is used to assign a password to the created user.
9) Can we create a new user with an expiry date?
- Yes
- No
Correct answer: 1
Yes
Yes, we can create a new user with an expiry date; it means the user gets deleted automatically after a particular date.
10) Which of the following commands are used to know about the current user?
- who
- whoami
- who am i
- w
Options:
- A and B
- C and D
- A, B, and C
- A, B, C, and D
Correct answer: 4
A, B, C, and D
All given commands are used to know about the current user.
11) There are the following statements that are given below, which of them are correct about the "id" command in the Linux operating system?
- This command describes the user id.
- This command describes the group id.
- This command describes the list of groups belongs to the user.
- All the above
Options:
- A and B
- A and C
- B and C
- D
Correct answer: 4
D
All statements are correct about the id command.
12) How to change the normal user to root user using the terminal in the Linux operating system?
- Using sudo command
- Using su command
- Using super command
- None of the above
Correct answer: 2
Using su command
Using su command is used to change a normal user to root user.
13) Can we create a new user without becoming a root user?
- Yes
- No
Correct answer: 1
Yes
Yes we can create a new user without becoming root user using the sudo command.
14) Which file contains encrypted user's passwords?
- /etc/passwords
- /etc/shadow
- /etc/pwd
- /etc/pwds
Correct answer: 2
/etc/shadow
The /etc/shadow file contains encrypted user's passwords.
15) Can a non-root user read /etc/shadow file?
- Yes
- No
Correct answer: 2
No
No, a non-root user cannot read /etc/shadow file.
16) Which Linux command is used to create an encrypted password?
- encrypt passwd
- secure passwd
- openssl passwd
- All the above
Correct answer: 3
openssl passwd
The openssl password command is used to create an encrypted password.
17) There are the following statements that are given below, which of them are correct about "/etc/login.defs" file in the Linux operating system?
- In this file, we can define the maximum number of days a password may be used.
- In this file, we can define the minimum number of days allowed between password changes.
- In this file, we can also define the minimum and maximum length of the password.
- There is no "/etc/login.defs" file exists in the Linux operating system.
Options:
- A and B
- A and C
- A, B and C
- D
Correct answer: 3
A, B and C
Statements A, B, and C are correct about /etc/login.defs file.
18) Which command is used to know information about a password?
- change
- knowpass
- passinf
- info
Correct answer: 1
change
The change command is used to know password information.
19) Which command is used to enable/disable password for a particular user?
- usermod
- userenable
- userdisable
- change
Correct answer: 1
usermod
The usermod command is used to enable and disable password for a particular user.
20) Which exact command is used to disable password for a particular user?
- usermod -D <user name>
- usermod -d <user name>
- usermod -l <user name>
- usermod -L <user name>
Correct answer: 4
usermod -L <user name>
The 4th option is correct command to disable password for a particular user.
21) Which command is used to create a new group in the Linux operating system?
- creategroup
- addgroup
- groupadd
- groupcreate
Correct answer: 3
groupadd
The groupadd command is used to create a new group.
22) Which command is used to know about groups that belong to the current user?
- grouplist
- groups
- groupinfo
- groupinformation
Correct answer: 2
groups
The groups command is used to know about groups that below to current user.
23) Which command is used to rename the existing group?
- rename
- rengroup
- groupmode
- groupmod
Correct answer: 4
groupmod
The groupmod command is used to rename the existing group.
24) Which command is used to remove an existing group?
- removegroup
- deletegroup
- groupdel
- grouprmv
Correct answer: 3
groupdel
The groupdel command is used to remove an existing group.
25) Which command is used to pass control of group membership to another user?
- groupuser
- gpasswd
- grouppasswd
- None of the above
Correct answer: 2
gpasswd
The gpasswd command is used to pass control of group membership to another user.