LinuxQuestions.org
Help answer threads with 0 replies.
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 09-05-2018, 02:45 AM   #1
tankzeu
LQ Newbie
 
Registered: Sep 2018
Posts: 26

Rep: Reputation: Disabled
Starting systemd service as non-root


Hello,I was wondering can I configure .service file to be started,stopped,restarted without requiring root with the systemctl command?
 
Old 09-05-2018, 03:42 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275
as far as I know systemctl can only be executed by root. I don't know what do you want to achieve, but probably need to find another way to solve your issue.
 
1 members found this post helpful.
Old 09-06-2018, 01:42 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
systemd itself will always need root privileges to start, but there's such a thing as user services:
https://wiki.archlinux.org/index.php/Systemd/User
iirc the initial setup still requires root, though.
 
1 members found this post helpful.
Old 09-06-2018, 06:20 PM   #4
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Rep: Reputation: 58
as far as I know, system checks for remote logins before light. this is said to be done to allow developers to easily do "remote debugging"

yes you can do it. it is simple as changing permissions. if you don't already know how it would be too difficult to fully describe in a reply post.

there are many articles about starting up OS services and how to make them run as a particular user with instructions what to do exactly
 
Old 09-07-2018, 02:32 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275
If you want to start a specific service as a user probably sudo can help you. But you still need to tell us what do you really need.
 
Old 09-07-2018, 02:53 AM   #6
tankzeu
LQ Newbie
 
Registered: Sep 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
If you want to start a specific service as a user probably sudo can help you. But you still need to tell us what do you really need.
So I am trying to distribute a service with systemd to many clients and when they start the service with "systemctl start someService.service" I don't want them to be required to type in the root password and also the start/stop/restart mechanism to be safe - by that I mean that if the service is started and the user logs out from the console and enter as another user the service should be stopped
 
Old 09-07-2018, 03:53 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275
Quote:
Originally Posted by tankzeu View Post
I don't want them to be required to type in the root password
so check how sudo works.

Quote:
Originally Posted by tankzeu View Post
if the service is started and the user logs out from the console and enter as another user the service should be stopped
This is a very different task and much harder to implement. If possible at all.
But probably someone can construct a helper script to implement it.
 
  


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 systemd service as a user, but run ExecStartPost as root MQMan Linux - Server 7 05-06-2019 12:35 PM
gnome DE neither starting from . xinitrc(root user) nor from systemctl enable gdm.service ShaunXenon Arch 16 01-15-2017 01:12 PM
Can't access full journalctl from script via systemd service even though user is in systemd-journal group iwtbf Linux - Newbie 0 02-19-2016 02:44 PM
Boot Delay 30min: systemd-analyze blame systemd-tmpfiles-setup.service BGHolmes Fedora 0 07-27-2011 09:02 AM
Starting a service as non root user? dee3lmo Linux - General 2 07-30-2004 07:37 PM

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

All times are GMT -5. The time now is 07:03 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
Open Source Consulting | Domain Registration