Find the answer to your Linux question:
Results 1 to 7 of 7
Hello, I have a binary (generated from a c program) that performs ioctl(...) system call, which requires root or sudo rights. How can this binary be run by a normal ...
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    6

    How to run binary as root or su

    Hello,

    I have a binary (generated from a c program) that performs ioctl(...) system call, which requires root or sudo rights. How can this binary be run by a normal user without entering su password? Thanks.

    George

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Make mine Arch Linux

  3. #3
    Linux Newbie
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    144
    Quote Originally Posted by gwang09 View Post
    Hello,

    I have a binary (generated from a c program) that performs ioctl(...) system call, which requires root or sudo rights. How can this binary be run by a normal user without entering su password? Thanks.

    George
    If a program could elevate itself to root level without a password it'd defeat the whole point of user-level security, no?
    "If it compiles, sell it."

  4. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quote Originally Posted by andrewdodd13 View Post
    If a program could elevate itself to root level without a password it'd defeat the whole point of user-level security, no?
    Yes and no...some programs by their very nature require users to access root level
    Make mine Arch Linux

  5. #5
    Linux Newbie
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    144
    Quote Originally Posted by gerard4143 View Post
    Yes and no...some programs by their very nature require users to access root level
    Of course, but without a password?
    "If it compiles, sell it."

  6. #6
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quote Originally Posted by andrewdodd13 View Post
    Of course, but without a password?
    Yes..an example would be a login program..
    Make mine Arch Linux

  7. #7
    Linux Newbie
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    144
    Quote Originally Posted by gerard4143 View Post
    Yes..an example would be a login program..
    These daemons I guess you're thinking of are launched during startup while the system is still in single-user mode, and run based on a configuration file which only root should be able to edit. A non-root user could run these programs but in general they would still be run as that users PID.

    Generally the best way to do what you're wanting to do is in fact write an abstraction daemon which runs at start-up and provides a mechanism for reporting the result of the call to the program. This still requires root to install the program, unless a non-priviledged user has access to the init scripts (insecure).
    "If it compiles, sell it."

Posting Permissions

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