I was experimenting a bit and noticed something strange: setting the setuid bit on a copy of bash located at /usr/bin/bash-test
seemed to have no effect. When I ran an instance of bash-test
, my home directory was not set to /root
and when I ran the whoami
command from bash-test
, my username was not reported as being root
, suggesting that bash-test
was not running as root. However, if I set the setuid bit on whoami
, I was reported as being root in any shell, as expected.
I tried setting the setuid bit on /usr/bin/bash
as well and observed the same behavior.
Why is bash not running as root when I set the setuid bit on it? Could selinux have something to do with this?