MCQ

Linux MCQs – Managing of users accounts and groups

Multiple choice questions and answers (MCQs) on Linux focuses on “Managing of users accounts and groups” to prepare for exams, interviews, and certifications, such as Redhat exam, CompTIA exam, Ubuntu / SuSE certification, LPI certification exam. These MCQs will easily prepare anyone to pass their Linux test.
 

1. The encrypted password of a user is stored in ____

A /etc/shadow

B /etc/enpasswwd

C /etc/.passwd

D /etc/passwd

A
The /etc/shadow file, contains the encrypted password as well as other information such as account or password expiration values, etc. The /etc/shadow file is readable only by the root account and therefore does not represent a great security risk.

 

 

2. A user can change the default shell connection using ______?

A chmod

B chsh

C rmsh

D tchsh

B
You don’t need to modify the /etc/passwd file to change your shell. You need to use the “chsh” command. It changes the user’s login shell. This determines the users initial login name. A normal user can only change the login shell for his own account, the super user (root), can change the login shell for any account. Here is the syntax of the chsh command:

$ chsh -s {shell_name} {user_name}

 

 

3. When a user is created, the group ID GID is listed in which file?

A /etc/passwd

B /etc/groups

C /etc/login

D /etc/profile

A
The /etc/passwd file is a file that contains :

  • The username
  • The encrypted password
  • The user ID (UID)
  • The user group ID (GID)
  • The user’s full name (GECOS)
  • The user’s home directory
  • Login shell.

Example; information is separated by a colon:

$ cat /etc/passwd

Alex:*:202:1:Alex Doe:/home/adoe:/usr/bin/ksh
Bob:*:312:2:Alex Doe:/home/bob:/usr/bin/sh

 

 

4. Which of the following identifiers associated with a process that determines its privilege level?

A uid

B suid

C euid

D gid

C
Each process has three IDs: RUID(real user ID), EUID(effective user ID) and SUID(saved user ID). The idea is that a process can temporarily acquire privileges, then give them up when it no longer needs them, and get them back when it needs them again. There is a similar mechanism for groups, with RGID(real group ID), EGID(effective user ID), SGID(saved group ID) and additional groups.
 
A program that needs to perform certain actions with root privileges normally runs with its EUID, but it calls the seteuid() method to set its EUID to 0 before performing the action requiring privileges.

 

 

5. User ID which equals 0 is ______ ?

A An invalid identifier

B The user ID of the root user

C User ID when their account is deleted

D None of the above

B
Does the user root always have uid = 0 and gid = 0 on Linux? Yes. There is code in the kernel that explicitly checks that uid equals 0, which means that root always has at least uid = 0.

 

 

6. The shell connection is _____?

A The shell program that runs when the user logs in

B The shell program that authenticates the user during the connection

C The shel program is shared between users belonging to the same group

D None of the above

A
Shell is a program that receives commands from the user and transmits them to the operating system for processing, and displays the results.

 

 

7. Which of the following commands can be used to change the user’s password?

A The user cannot change his password

B passwd

C passd

D pwd

B
You can change the user’s password by running the command “passwd user” (where user is the username of the password you just changed).

 

 

8. What does the following command do?
$ who | wc –l

A Indicate the number of connected users

B List users

C Specify the number of users in the system

D Display the content of the command line

A

The command line $ who | wc –l : indicates the number of users connected to a session.

 

 

9. By default, a Linux user belongs to which group?

A Personnel

B Others

C Same as user ID

D System

C
Users are organized in groups, each user belongs to at least one group and can belong to other groups. Belonging to a group gives you special access to the files and directories authorized for that group.

By default, a Linux user belongs to the same group as the user ID (UPG).
UPG or User Private Group is a unique group ID with the same name as the user ID.

 

 

10. The output of ls -l for /etc/passwd and /usr/bin/passwd is as follows?
$ ls -l /etc/passwd
-rw-rw-r-- 1 root root 1107 Juin 01 01:55 /etc/passwd
$ ls -l /usr/bin/passwd
-r-s—x—x 1 root root 23395 May 12 01:24 /usr/bin/passwd

If a user not belonging to the “root” group and executes the passwd command to try to change his password, which of the following is true?

A Changing password fails because the user is not allowed to update the /etc/passwd file

B Changing password successfully because the program runs as root

C The program that change password runs in kernel mode where it’s possible to write in /etc/passwd file

D /etc/passwd is a special file and the default system allows all users to update it

B
A user normally needs to know his current password to change it to a different one. The “passwd” program checks this. However, root can change any user’s password without knowing the old one; therefore, a user with sudo privileges can change his own password without entering it at the passwd prompt by running sudo passwd $USER. If sudo is configured to require the user’s password, the user must type the password into sudo.

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *