I know about setuid
bit on /bin/passwd
file which allows us (non-root user) to run that command as root
user. running passwd
command requires root
permissions to change /etc/shadow
file.
My question is if I am running passwd
command as root
why I can't change the password of root
since I am root
while I am running that command?
edward@ArchLinux:~$ passwd root
passwd: You may not view or modify password information for root.
Is it passwd
command that does not allows non-root user to change the password? Can I write a malicious passwd
command with setuid bit that can change any user's password?
(Logically I know that this would be disastrous but I want to know how this works in background)
passwd
command is made not to allow non-root user to change password of other users? can I modify passwd command with setuid to change password of root? – Alex Jones Feb 04 '16 at 12:47passwd
, you can get it to do anything, right? – muru Feb 04 '16 at 12:48passwd
? If so, why would you need to writepasswd
to do "malicious" stuff? – muru Feb 04 '16 at 13:10