Results 1 to 7 of 7

Thread: C Help

  1. #1
    Join Date
    Feb 2007
    Location
    Portland, OR
    Beans
    127
    Distro
    Ubuntu 8.04 Hardy Heron

    C Help

    I have been battling what I have come to find is a lost cause. I have a bash script that I need to run as root, and would like to hot key it, so I would like to make it not prompt me for a password. This led me to learn about the SUID of the file, and thought that it would work, but then i found out that the SUID is ignored for scripts (which makes sense, as the security flaw that it is...)

    So the workaround that people have been using is using the SUID on a compiled file as that will still work. People have been writing a program in C that will launch a script. I have no idea how to do this.

    I do all my programming in interperted languages (Python and PHP mostly) and have virtually no experience with any C languages.

    Anyone want to help me out with a tutorial, link, or (if you are way too awesome) some source code?
    -------------
    eh.

  2. #2
    Join Date
    Jul 2008
    Location
    /home/stephen
    Beans
    165
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: C Help

    if you need c tutorials, check out cprogramming.com
    if you need C++ tutorials, check out cplusplus.com/docs

    Check out the sticky at beginning of forum!
    Be careful what you tinker around with

  3. #3
    Join Date
    Jan 2007
    Beans
    768
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: C Help

    You could use visudo to edit your sudoers file to enable you to run your script as root using sudo without prompting for a password. This is the "standard" way of doing it and safer than making a SUID executable.

  4. #4
    Join Date
    Feb 2007
    Location
    Portland, OR
    Beans
    127
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: C Help

    well i am currently reading through laroza's c guide, so please don't think I am doing nothing and leaving this to the ubuntu forums programming group.

    Just wondering if anyone has done anything like this in the past, as I don't really want to learn all there is to C, just want a solution. I'm willing to learn to make this happen, but would also like to have this work ASAP.
    -------------
    eh.

  5. #5
    Join Date
    Feb 2007
    Location
    Portland, OR
    Beans
    127
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: C Help

    kpatz:
    do you have valid syntax for that? I tried that earlier and broke my sudoers file. I know how to make a user system wide unprompted for passwords, but that is way too unsecure for my tastes...
    -------------
    eh.

  6. #6
    Join Date
    Nov 2005
    Location
    Sendai, Japan
    Beans
    11,296
    Distro
    Kubuntu

    Re: C Help

    Something like:

    Code:
    user ALL=(ALL) NOPASSWD: /path/to/script.sh
    Of course, replace user with the name of the user that will be permitted to run it password-less, and enter the correct path to the script
    「明後日の夕方には帰ってるからね。」


  7. #7
    Join Date
    Feb 2007
    Location
    Portland, OR
    Beans
    127
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: C Help

    wow. thank you. I feel like michael bolton from office space right now. stupid syntax mistakes suck.

    thanks a million.
    -------------
    eh.

Bookmarks

Posting Permissions

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