Results 1 to 6 of 6

Thread: How do I give a specific user permission to start/stop a specific service?

  1. #1
    Join Date
    Jan 2006
    Beans
    Hidden!

    Question How do I give a specific user permission to start/stop a specific service?

    As the topic says:
    How do I give permission to a logged in user to stop/start a specific service without entering a root/sudo password?

    So they can do a simple "service SomeService stop|start"


    It is for a headless Ubuntu server.

  2. #2
    Join Date
    Nov 2008
    Location
    Southern Ontario, Canada
    Beans
    253
    Distro
    Ubuntu Development Release

    Re: How do I give a specific user permission to start/stop a specific service?

    I'm not sure...but I have an inkling if you read up on visudo ('man visudo') you'd probably find what you're looking for.

  3. #3
    Join Date
    Jun 2008
    Location
    UK
    Beans
    1,803
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I give a specific user permission to start/stop a specific service?

    probably not a good idea to let all users access to root commands.

    Suggest this article is something like what you want - effectively it gives certain users access to sudo but for specific services.

  4. #4
    Join Date
    Jan 2006
    Beans
    Hidden!

    Re: How do I give a specific user permission to start/stop a specific service?

    No, access to root services for everyone is defenitly NOT what I want

    I'll try to clarify it a bit:
    I want to allow a user to run a command that will stop/start a specific service. I do not want users to have access to anything else than that without using sudo as they normally would. I have had a look at the sudoers file already and it does look like the correct way but I'm not sure how to accomplish it and I might accidentally allow more than what I'm looking for without some guidance
    Great links: Tutorials & Tips Forum - GNOME System Administration Guide - Bash-Scripting Guide
    Remember: Please mark your thread as [ SOLVED ] if you found a working solution!

  5. #5
    Join Date
    Jan 2006
    Beans
    Hidden!

    Re: How do I give a specific user permission to start/stop a specific service?

    It does seem that sudo is the correct way to accomplish what I want. I had a look at sudo's homepage and found some good examples.

    I'll mark the thread as solved and post the answer if it works out
    Great links: Tutorials & Tips Forum - GNOME System Administration Guide - Bash-Scripting Guide
    Remember: Please mark your thread as [ SOLVED ] if you found a working solution!

  6. #6
    Join Date
    Jan 2006
    Beans
    Hidden!

    Re: How do I give a specific user permission to start/stop a specific service?

    Okay i found a way

    Edited the sudoers file ("sudo visudo") and added something like this:
    Code:
    USER        ALL = NOPASSWD: /usr/sbin/service ServiceName *
    This will allow the user to run "sudo /usr/sbin/service ServiceName" with any or zero following attributes (ie. start|stop).
    I also learned something new:

    Code:
    service ServiceName --full-restart
    This will first run "service ServiceName stop" and then "service ServiceName start". Nice
    Last edited by TheForumTroll; June 9th, 2010 at 01:19 AM. Reason: Solved!
    Great links: Tutorials & Tips Forum - GNOME System Administration Guide - Bash-Scripting Guide
    Remember: Please mark your thread as [ SOLVED ] if you found a working solution!

Tags for this Thread

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
  •