[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sticky permissions on files...



You normally don't have permission to write a file in the /bin directory
as a normal user...

On Fri, 2005-01-28 at 05:59 +0000, Ken Keefe wrote:
> So, I have written a script that when run swaps two config files and
> restarts a service. Now, I'd like any user on my system to have the
> ability to use it. However, to write to the directory that the config
> files are in the user must be root. My understanding is that once you do
> the following, anyone who runs that script will temporarily have the
> same rights as root. So here's my test script:
> 
> #!/bin/sh
> echo "I am `whoami`"
> echo "Test" > /root/temptest
> 
> And I used the following chmod statements:
> 
> chmod 775 myscript
> chmod u+s myscript
> 
> This left the file with the permission signature of:
> 
> -rwsrwxr-x   1 root root    433 Jan 27 23:46 myscript
> 
> Which is exactly what I was expecting, however when I run the script I
> get exactly what I am not expecting... 
> 
> [kaje@localhost bin]$ ./myscript
> I am kaje
> ./myscript: line 3: /root/temptest: Permission denied
> 
> What is the deal???
> 
> Ken
> 
> 
> -
> To unsubscribe, send email to majordomo@silug.org with
> "unsubscribe silug-discuss" in the body.
> 
-- 
Paul Nicholas McCubbins <nick77@dtnspeed.net>


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.