I have Ubuntu 20.04 virtual server.
I have an executable file script.sh in /opt that has SetUID bit set.
meliwex@linode:/opt$ ls -ld /opt
drwxr-xr-x 2 root root 4096 Dec 19 03:45 /opt
meliwex@linode:/opt$ ls -l
total 4
-rwsr-xr-x 1 root root 125 Dec 19 03:45 script.sh
meliwex@linode:/opt$
When I run this file with non-root user the effective UID of the process doesn't change, why?
meliwex@linode:/opt$ ./script.sh&
[1] 1200
meliwex@linode:/opt$ ps -elf | grep -i script.sh
0 S meliwex 1200 733 0 80 0 - 1756 do_wai 03:52 pts/0 00:00:00 /bin/bash ./script.sh
0 S meliwex 1205 733 0 80 0 - 1609 pipe_w 03:52 pts/0 00:00:00 grep --color=auto -i script.sh
meliwex@linode:/opt$ ps -eo pid,ruid,euid | grep -i 1200
1200 1000 1000
meliwex@linode:/opt$
Here I guess it should be: 1200 1000 0