Thursday, November 13, 2008

SU Error - su: not running setuid If this error occures while you try to su, it means that you need to set SUID bit to su binary like below: $ su -

SU Error - su: not running setuid

If this error occures while you try to su, it means that you need to set SUID bit to su binary like below:

$ su -
su: not running setuid

(BECOME ROOT SOMEHOW AND THEN...)

# ls -l `which su`
-r-xr-x--- 1 root wheel 14324 Apr 12 23:14 /usr/bin/su
# chmod u+s `which su`
# ls -l `which su`
-r-sr-x--- 1 root wheel - 14324 Apr 12 23:14 /usr/bin/su
# su - andrei
$ su -
Password:


So above commands do:

  1. ls -l `which su` - lists su binary
  2. chmod u+s `which su` - adds SUID bit to su binary
  3. exactly like 1.
  4. su to another user ( andrei in this case)
  5. su to root from a normal user. See that the error does not occure any more.

notes: instead of `which su` you could use directly /path/to/su/binary if you know it, and you can use `which su` and it'll work on both Linux & FreeBSD.

This error occured after a buildworld. I suspect that because of file flags I use.

No comments: