Answer the question
In order to leave comments, you need to log in
Why can Linux users change their password with the passwd command if they don't have permission to write the /etc/shadow file?
/etc/shadow can only be modified by root, other users cannot modify or view it. But if the user changes his password on his own, the changes will still be written to the file.
How it works?
Answer the question
In order to leave comments, you need to log in
read about special access rights SUID and SGID, which allow you to run programs on behalf of other users. Several programs have this flag, popular ones are passwd, sudo
$ ls -sl1sFa /usr/bin/sudo /usr/bin/passwd
60 -rwsr-xr-x 1 root root 59640 Mar 22 2019 /usr/bin/passwd*
148 -rwsr-xr-x 1 root root 149080 Jan 31 17:18 /usr/bin/sudo*
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question