Find the answer to your Linux question:
Results 1 to 4 of 4
Hi. 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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4

    run bash commands as root.


    Hi.

    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.

    Merci
    Julia

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    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
    Just Joined!
    Join Date
    Apr 2009
    Posts
    4
    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?
    Julia

  4. #4
    Just Joined! DT0X's Avatar
    Join Date
    Nov 2008
    Location
    Southwest UK
    Posts
    31
    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
  •