(Ubuntu) setuid bash doesn't work

Posted by ??? on Server Fault See other posts from Server Fault or by ???
Published on 2009-12-13T13:18:41Z Indexed on 2010/12/22 16:55 UTC
Read the original article Hit count: 337

Filed under:
|

Here is the code:

(root:)

# mkdir /test
# cp /bin/bash /test/sbash
# chmod a+s /test/sbash

(user1:)

$ cd /test
$ ./sbash
$ mkdir trycreate
mkdir: cannot create directory `trycreate': Permission denied

And bash scripts with setuid bit set not work, either.

By the way, my setuid perl script works:

test.pl: (with setuid bit set, owner=root)

#!/usr/bin/perl
mkdir('/test/tryperlcreate') or die 'failed';

execute test.pl by user1 will create the directory owned by root.

© Server Fault or respective owner

Related posts about bash

Related posts about setuid