xxxxxxxxxxx How a normal user changes his password and updated shadow file xxxxxxxxxxxxx
Note:
permission on /etc/shadow is: 400
permission on /etc/password : 644
permission on /usr/bin/passwd : 4755 ( suid is set)
Can root change own/others password ?: yes (Even he is having read permission on shadow,
but ofcourse root can update any file which is on properly mounted partition)
But can a normal user change his pasword ? : Yes (HOW? he is not having write permission on password and even not having read permission on shadow so how????)
Here's the solution why??
# which passwd
/usr/bin/passwd
# ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 27768 Jan 6 2007 /usr/bin/passwd
Note: The permission on command binary /usr/bin/passwd is 4755 mean any user can execute it and suid is set on it mean, it must be executed as root it's dose not matter who is executing it, and root have authority to update any file .
But if we look into this scenario then can user keep any password of him and can he change any's password Noooo???
Because passwd binary it's itself authenticate via PAM and run accordingly.
=> inode is is data structure in unix/linux file system
Note:
permission on /etc/shadow is: 400
permission on /etc/password : 644
permission on /usr/bin/passwd : 4755 ( suid is set)
Can root change own/others password ?: yes (Even he is having read permission on shadow,
but ofcourse root can update any file which is on properly mounted partition)
But can a normal user change his pasword ? : Yes (HOW? he is not having write permission on password and even not having read permission on shadow so how????)
Here's the solution why??
# which passwd
/usr/bin/passwd
# ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 27768 Jan 6 2007 /usr/bin/passwd
Note: The permission on command binary /usr/bin/passwd is 4755 mean any user can execute it and suid is set on it mean, it must be executed as root it's dose not matter who is executing it, and root have authority to update any file .
But if we look into this scenario then can user keep any password of him and can he change any's password Noooo???
Because passwd binary it's itself authenticate via PAM and run accordingly.
=> inode is is data structure in unix/linux file system