I wonder what happens what happens when I am changing my password on a Linux system. Basically all passwords are stored in a file called /etc/shadow
or /etc/master.passwd
in BSD-like systems as I do remember. Both of them are owned by root/wheel with 600 permissions.
So when I change my password using passwd
command in terminal it should somehow access this file with root permissions. Then read and write to it.
I am interested in how does it get the root permissions and which process (or processes) are responsible for password change.