My question is about suid
! The logic behind that is to grant root permission when a privileged command is executed by a user. For example, passwd
has such a feature.
$ ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 54224 Aug 21 2017 /usr/bin/passwd
I have written a piece of code which opens a zsh
. So, I manually add suid
to my executable.
$ chmod u+s myzs
$ ls -l myzs
-rwsr-xr-x 1 mahmood mahmood 7360 Jul 6 21:34 myzs
However, when I run the binary, the shell opens for the current user (me) and not the root. What is the difference between my binary file and passwd? both have suid.
$ ./myzs
% whoami
mahmood