I made this stupid mistake and it take me some time.
Sticky bit for script file not work
for script file
user:coolder
cat check_euid.shecho $EUID
➜ Bin bash check_euid.sh1000
change owner to root:root
➜ Bin sudo chown root:root check_euid.sh
add sticky bit for the script
➜ Bin sudo chmod +s check_euid.sh
$EUID will not change !!!
➜ Bin lsa.c a.out check_euid.sh➜ Bin sudo chown root:root check_euid.sh➜ Bin sudo chmod +s check_euid.sh➜ Bin whoamicoolder➜ Bin bash check_euid.sh1000➜ Bin
for binary file
user:coolder
➜ Bin cat a.c#include<unistd.h>#include<sys/types.h>int main(void){printf("%d %d", getuid(), geteuid());}
compile and run
➜ Bin ./a.out1000 1000%
effect on binary file !!!
➜ Bin sudo chown root:root a.out➜ Bin sudo chmod +s a.out➜ Bin ./a.out1000 0%
