unix - why normal User can't change password of others if suid bit is set on passwd -
as per suid concept, if suid bit set on file/executable file , normal user execute command. command executed privilege of owner of file/command.
suid bit set on "passwd" command , root owner of passwd. if normal user "user1" execute command 'passwd' executed root privilege. however, can change password not others. why so?
suid
bit doesn't make run root. merely allows make setuid
system call, elevate it's privileges.
passwd
requires root privileges update user credentials. quite cautiously though - starts in user context, verifies stuff, , escalates privileges make system change. being set setuid
doesn't have bearing on - merely allows this.
if want accomplish non-root password changing should use sudo
run passwd
root.
if want, write own command embeds setuid
system call, sudo
better approach.
Comments
Post a Comment