LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-12-2016, 12:55 PM   #1
vedant.n
LQ Newbie
 
Registered: Aug 2016
Posts: 1

Rep: Reputation: Disabled
How to start / stop linux services with a non-root user?


I have some services registered under /etc/init.d. I have given permissions (-rwxrwxrwx) for these services using root. However when I try to start / stop these services using a non-root user, I am required to enter a su password. Is there a way where the non-root user would be able to start / stop the service without the su password?
 
Old 08-12-2016, 01:46 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,617

Rep: Reputation: 442Reputation: 442Reputation: 442Reputation: 442Reputation: 442
Quote:
Is there a way where the non-root user would be able to start / stop the service without the su password?
Create a system user and group, then make that user/group the owner/group of the service.
Code:
sudo useradd -r nibiru
sudo groupadd -r nibiru
sudo chown nibiru:nibiru /etc/rc.d/myservice
To run the service from another $USERNAME make the latter a member of that group. Be sure your service script is owned 770 granting execution by the group member.
Code:
usermod -a -G nibiru sitchin
Then login as user sitchin and run the service.

Hope that helps.
 
Old 08-12-2016, 02:09 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,476
Blog Entries: 10

Rep: Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639
Or edit the sudoers file so that you do not need to use your password to use the sudo command.

I personally always have to look it up.

http://askubuntu.com/questions/19205...th-no-password
http://askubuntu.com/questions/33431...r-all-commands
http://www.ducea.com/2006/06/18/linu...sswd-nopasswd/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
start/stop tomcat6 as non-root user krishnanr03 Linux - Server 9 01-21-2014 01:41 PM
start, stop services johnkalikavunkal Solaris / OpenSolaris 1 07-14-2008 05:43 AM
LXer: Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Servi LXer Syndicated Linux News 0 12-13-2007 02:10 PM
How a non-root user start services sunlinux Linux - General 3 08-28-2007 05:52 AM


All times are GMT -5. The time now is 04:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration