I follow the steps:
- Login as root in my Ubuntu
- Create user alex without root privileges
- run
chmod u+s /bin/bash - Login as alex
- Run
ls /rootand got permission denied - Trying
/bin/bash -c "ls /root"from alex also results in permission denied
Adding suid bit to bash is equivalent to running sudo bash, with root privileges.
Why do I get permission denied?
Looks like -p bash option should help, but why?