Results 1 to 4 of 4
Hey guys,
I'm running a script which calls a compiled C program called cu. I'm logged in as root and when I run it the C program falls over with ...
- 09-14-2008 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 5
Permission denied even as root
Hey guys,
I'm running a script which calls a compiled C program called cu. I'm logged in as root and when I run it the C program falls over with Permission denied when trying to mkdir /usr/spool . I was able to manually create the spool directory but now the program is trying to create files in the spool directory and still has permission denied.
Why would I get permission denied if I'm running as root ? I also did a chmod 777 on both the script and cu program. I run the script with
sh ./script.sh
Any help would be much appreciated.
Thanks
- 09-14-2008 #2
Have you ensured that your script and cu both have root as their effective uid's? Not sure why they wouldn't, but it's worth checking.
- 09-14-2008 #3Just Joined!
- Join Date
- Sep 2007
- Posts
- 5
I think they have, I did a "ls -al" and the names beside them are root, is this the right way to check the uid ?
Well just after getting the script to work, I manually did
"chmod -R 777 /usr/spool/"
which meant that when the program went to write to that directory it definitly had permissions. I know this is more a hack than a solution but I got the script to work which is what I really wanted.
Nonetheless if anyone knows why the root permissions didn't carry through to the program that was called by the script i'd still like to know.
- 09-14-2008 #4
I'm glad you got it fixed. I know it's not "fixed", but it was a good enough little hack to get the job done. If you're curious, trying making calls to getuid() and geteuid() in your program and see what they give you. To make sure your program is running effectively as root, put in seteuid(0).


Reply With Quote