Hi
Consider the following statements at the root prompt:
[ ]# echo 'mkdir $*' >/usr/bin/mymkdir [ ]# chmod +x,u+s /usr/bin/mymkdir
Now if a user executes this script
[ ]$ cd / [ ]$ mymkdir hello mkdir: cannot create directory `hello': Permission denied
it gives permission denied error. Whats wrong? Isn't the script suid to root? Why isn't 'mkdir' getting root privilege?
Abhir
On Sat, May 25, 2002 at 02:32:55AM +0530, Abhir Joshi wrote:
Hi
Consider the following statements at the root prompt:
[ ]# echo 'mkdir $*' >/usr/bin/mymkdir [ ]# chmod +x,u+s /usr/bin/mymkdir
Now if a user executes this script
[ ]$ cd / [ ]$ mymkdir hello mkdir: cannot create directory `hello': Permission denied
it gives permission denied error. Whats wrong? Isn't the script suid to root? Why isn't 'mkdir' getting root privilege?
Afaik, it won't work. It works only with binary executables.
( You can write a C program, and call the commands with the "system" call ).