setuid issue
I am running openSuse Linux. I want to create a file in /etc/ directory from a normal user, so what I did is, created a C program from root, compile it and set setuid bit(using command chmod ug+s ./a.out) of the executable generated. Now when I run the program from a normal user, it says "touch: cannot touch `/etc/test': Permission denied"
Here is my program. #include<stdio.h> int main() { system("touch /etc/test"); return 0; } Why it is saying permission denied as I had already set the setuid bit? |
Hi
It's because of the permissions set on /etc/ |
Quote:
scott@tom:~> ls -la ./a.out -rwsr-sr-x 1 root root 9505 2009-10-14 13:03 ./a.out Even I has also tried by giving the write permission to /etc directory but it still not working. |
All times are GMT -5. The time now is 01:25 PM. |