LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 11:55 AM   #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, 12:46 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
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, 01:09 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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



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 12:41 PM
start, stop services johnkalikavunkal Solaris / OpenSolaris 1 07-14-2008 04:43 AM
LXer: Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Servi LXer Syndicated Linux News 0 12-13-2007 01:10 PM
How a non-root user start services sunlinux Linux - General 3 08-28-2007 04:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:19 PM.

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
Open Source Consulting | Domain Registration