Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    run bash commands as root.


    I need to launch a bash file in Linux from an unprivileged user session, file that will run bash commands as root. But I do not want to create an user with root privileges to do that.


  2. #2
    SuperMod (Back again) devils casper's Avatar
    Join Date
    Jun 2006
    Chandigarh, India
    You can use SUID.
    SUID stands for set user id. When a SUID file executed, the process which runs it is granted access to system resources based on the user who owns the file and not the user who created the process. When a file is SUID root it allows a program/script to perform functions that regular users are not allowed to do themselves. Many buffer overflow exploits are the result of SUID programs.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Thanks ,
    It would be great if it worked, but
    I've created with root a file named /test
    then I've set the permissions to 107755
    then I've added in the file the " iptables -L" line
    changed the user to an unprivileged one
    and tried to exec the "test" file.
    the output was: iptables v1.3.5: can't initialize iptables table `filter': Permission denied (you must be root).

    What am I doing wrong?

  4. $spacer_open
  5. #4
    Just Joined! DT0X's Avatar
    Join Date
    Nov 2008
    Southwest UK
    You could also try sudo - add your unprivilieged user the ability to run the iptables command or whatever you need run as root (a quick google should turn you up a decent sudo config guide) you can even have the entire script run as root using sudo

    It basically involves configuring the /etc/sudoers file and enabling your user to run the relevant command needed then putting "sudo" before the command.

    Sorry Im a bit vague, Im in the middle of configuring Redhat-DS, I'll write a better reply if this is something that interests you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts