Discussion Locked

Linux File Permissions

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a script, called rc.antifirewall that uses the /sbin/ipchains program within it to bring down my firewall. Right now, because it uses ipchains, only root can run this script. I would like for regular users to be able to run this script, butI don't want them to be able to run the ipchains program by itselft, as they currently can't. I thought the way I should accomplish this was to have the script that I wrote be owned by root, then set the user id bit using chmod u+s rc.antifirewall,and have this file be executable by other. From my understanding, then anyone that ran this script would have the permissions of the owner, root in this case. For some reason when I execute the script when I am a regular user it just tells me 'permission denied'. All the script does is bring down my firewall and log who brought it down. I am not sure where my flaw is. Here are what my file permissions look like:

-rws--x--x 1 root root 1373 Mar 7 18:38 /etc/rc.d/rc.antifirewall
-rwxr-xr-x 1 root root 39416 Sep 20 1999 /sbin/ipchains

When I add a read permission to other on rc.antifirewall, such as:

-rws--xr-x rc.antifirewall

It get this message:

$ rc.antifirewall
ipchains: Permissiondenied
ipchains: Permission denied (you must be root)
ipchains: Permission denied (you must be root)
ipchains: Permission denied (you must be root)

Any help with this problem is appreciated.

2 replies

by nuggethunter

Just a thought, have you tried to give the users of this firewall file su user permissions for that file. If I remember correctly, su can have the same authority as root in many instances and by still using root as owner of the other part of your question, it would block the su users from accessing those files. it was just a thought,wild guess if you want to call it that !!! Good Luck...

by wiznogood

Hi,
'rpm -qi sudo' on my machine says:
'sudo' is a command that allows users to execute some commands as root. The /etc/sudoers file specifies which users have access to sudo and which commands they can run...

I think the sudo is your best bet.

This discussion is closed to new replies.