Home / Programming MCQs / Linux MCQs / Question

J

Jatin Dubey • 3.78K Points
Extraordinary

Q. The output of ls -l for /etc/passwd and /usr/bin/passwd is as follows?

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?

Code:
$ 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
(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
Explanation by: Jatin Dubey
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.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.