I'm on Ubuntu 20.04 and trying to run a command as root, but without using sudo and instead using the sticky bit.
I've read this answer but can't seem to get it to work.
I've created a script called whoami_root
to show the user that it is running as.
Output of cat whoami_root
:
#!/bin/bash
whoami
I have run sudo chown root whoami_root
and sudo chmod u+s whoami_root
Output of ll whoami_root
:
-rwsr-xr-x 1 root root 20 Nov 6 23:33 whoami_root
Output of ./whoami_root
myuser
Why does it seem to ignore the suid bit and run as myuser instead of root?