Running a service on CentOS as a system user other than root
I've created a system user jackett
(useradd -r jackett
) and I'm trying to run a systemd service under it on CentOS 7.
Service File:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
user=jackett
group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Service Status:
[root@server Jackett]# systemctl status jackett
● jackett.service - Jackett Daemon
Loaded: loaded (/usr/lib/systemd/system/jackett.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-02-23 23:42:23 +03; 11min ago
Main PID: 24735 (mono)
CGroup: /system.slice/jackett.service
└─24735 /usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/yourexotic.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zamundanet.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zelkaorg.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zooqle.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/ztracker.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Adding aggregate indexer
Feb 23 23:42:25 server mono[24735]: Hosting environment: Production
Feb 23 23:42:25 server mono[24735]: Content root path: /opt/Jackett/Content
Feb 23 23:42:25 server mono[24735]: Now listening on: http://[::]:9117
Feb 23 23:42:25 server mono[24735]: Application started. Press Ctrl+C to shut down.
htop
Shows Process Running Under Root
centos systemd root services not-root-user
add a comment |
I've created a system user jackett
(useradd -r jackett
) and I'm trying to run a systemd service under it on CentOS 7.
Service File:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
user=jackett
group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Service Status:
[root@server Jackett]# systemctl status jackett
● jackett.service - Jackett Daemon
Loaded: loaded (/usr/lib/systemd/system/jackett.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-02-23 23:42:23 +03; 11min ago
Main PID: 24735 (mono)
CGroup: /system.slice/jackett.service
└─24735 /usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/yourexotic.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zamundanet.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zelkaorg.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zooqle.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/ztracker.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Adding aggregate indexer
Feb 23 23:42:25 server mono[24735]: Hosting environment: Production
Feb 23 23:42:25 server mono[24735]: Content root path: /opt/Jackett/Content
Feb 23 23:42:25 server mono[24735]: Now listening on: http://[::]:9117
Feb 23 23:42:25 server mono[24735]: Application started. Press Ctrl+C to shut down.
htop
Shows Process Running Under Root
centos systemd root services not-root-user
@JeffSchallerlrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner tojackett
?
– AlGallaf
Feb 23 at 21:39
@JeffSchaller It shows the following-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.
– AlGallaf
Feb 23 at 21:43
I haven't experimented to know for sure, but you could also try capital-UUser
instead ofuser
... reference
– Jeff Schaller
Feb 23 at 21:50
1
Capital-U! Thanks @JeffSchaller! Service is working now underjackett
user.
– AlGallaf
Feb 23 at 21:53
add a comment |
I've created a system user jackett
(useradd -r jackett
) and I'm trying to run a systemd service under it on CentOS 7.
Service File:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
user=jackett
group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Service Status:
[root@server Jackett]# systemctl status jackett
● jackett.service - Jackett Daemon
Loaded: loaded (/usr/lib/systemd/system/jackett.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-02-23 23:42:23 +03; 11min ago
Main PID: 24735 (mono)
CGroup: /system.slice/jackett.service
└─24735 /usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/yourexotic.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zamundanet.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zelkaorg.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zooqle.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/ztracker.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Adding aggregate indexer
Feb 23 23:42:25 server mono[24735]: Hosting environment: Production
Feb 23 23:42:25 server mono[24735]: Content root path: /opt/Jackett/Content
Feb 23 23:42:25 server mono[24735]: Now listening on: http://[::]:9117
Feb 23 23:42:25 server mono[24735]: Application started. Press Ctrl+C to shut down.
htop
Shows Process Running Under Root
centos systemd root services not-root-user
I've created a system user jackett
(useradd -r jackett
) and I'm trying to run a systemd service under it on CentOS 7.
Service File:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
user=jackett
group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Service Status:
[root@server Jackett]# systemctl status jackett
● jackett.service - Jackett Daemon
Loaded: loaded (/usr/lib/systemd/system/jackett.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-02-23 23:42:23 +03; 11min ago
Main PID: 24735 (mono)
CGroup: /system.slice/jackett.service
└─24735 /usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/yourexotic.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zamundanet.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zelkaorg.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/zooqle.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Loading Cardigann definition /opt/Jackett/Definitions/ztracker.yml
Feb 23 23:42:24 server mono[24735]: 02-23 23:42:24 Info Adding aggregate indexer
Feb 23 23:42:25 server mono[24735]: Hosting environment: Production
Feb 23 23:42:25 server mono[24735]: Content root path: /opt/Jackett/Content
Feb 23 23:42:25 server mono[24735]: Now listening on: http://[::]:9117
Feb 23 23:42:25 server mono[24735]: Application started. Press Ctrl+C to shut down.
htop
Shows Process Running Under Root
centos systemd root services not-root-user
centos systemd root services not-root-user
edited Feb 23 at 21:38
Jeff Schaller
43.4k1160140
43.4k1160140
asked Feb 23 at 20:59
AlGallafAlGallaf
113
113
@JeffSchallerlrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner tojackett
?
– AlGallaf
Feb 23 at 21:39
@JeffSchaller It shows the following-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.
– AlGallaf
Feb 23 at 21:43
I haven't experimented to know for sure, but you could also try capital-UUser
instead ofuser
... reference
– Jeff Schaller
Feb 23 at 21:50
1
Capital-U! Thanks @JeffSchaller! Service is working now underjackett
user.
– AlGallaf
Feb 23 at 21:53
add a comment |
@JeffSchallerlrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner tojackett
?
– AlGallaf
Feb 23 at 21:39
@JeffSchaller It shows the following-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.
– AlGallaf
Feb 23 at 21:43
I haven't experimented to know for sure, but you could also try capital-UUser
instead ofuser
... reference
– Jeff Schaller
Feb 23 at 21:50
1
Capital-U! Thanks @JeffSchaller! Service is working now underjackett
user.
– AlGallaf
Feb 23 at 21:53
@JeffSchaller
lrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner to jackett
?– AlGallaf
Feb 23 at 21:39
@JeffSchaller
lrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner to jackett
?– AlGallaf
Feb 23 at 21:39
@JeffSchaller It shows the following
-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.– AlGallaf
Feb 23 at 21:43
@JeffSchaller It shows the following
-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.– AlGallaf
Feb 23 at 21:43
I haven't experimented to know for sure, but you could also try capital-U
User
instead of user
... reference– Jeff Schaller
Feb 23 at 21:50
I haven't experimented to know for sure, but you could also try capital-U
User
instead of user
... reference– Jeff Schaller
Feb 23 at 21:50
1
1
Capital-U! Thanks @JeffSchaller! Service is working now under
jackett
user.– AlGallaf
Feb 23 at 21:53
Capital-U! Thanks @JeffSchaller! Service is working now under
jackett
user.– AlGallaf
Feb 23 at 21:53
add a comment |
1 Answer
1
active
oldest
votes
The trouble is apparently that systemd is particular about case: User
instead of user
:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
User=jackett
Group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Reference:
- systemd.exec — Execution environment configuration -- User and Group
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502574%2frunning-a-service-on-centos-as-a-system-user-other-than-root%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The trouble is apparently that systemd is particular about case: User
instead of user
:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
User=jackett
Group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Reference:
- systemd.exec — Execution environment configuration -- User and Group
add a comment |
The trouble is apparently that systemd is particular about case: User
instead of user
:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
User=jackett
Group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Reference:
- systemd.exec — Execution environment configuration -- User and Group
add a comment |
The trouble is apparently that systemd is particular about case: User
instead of user
:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
User=jackett
Group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Reference:
- systemd.exec — Execution environment configuration -- User and Group
The trouble is apparently that systemd is particular about case: User
instead of user
:
[Unit]
Description=Jackett Daemon
After=network-online.target
[Service]
Type=simple
User=jackett
Group=jackett
ExecStart=/usr/bin/mono --debug /opt/Jackett/JackettConsole.exe --NoRestart
[Install]
WantedBy=multi-user.target
Reference:
- systemd.exec — Execution environment configuration -- User and Group
answered Feb 23 at 21:55
Jeff SchallerJeff Schaller
43.4k1160140
43.4k1160140
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502574%2frunning-a-service-on-centos-as-a-system-user-other-than-root%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@JeffSchaller
lrwxrwxrwx 1 root root 9 Feb 23 22:25 /usr/bin/mono -> mono-sgen
this is what I get. Should I change the owner tojackett
?– AlGallaf
Feb 23 at 21:39
@JeffSchaller It shows the following
-rwxr-xr-x 1 root root 4591120 Jan 17 11:50 /usr/bin/mono-sgen
.– AlGallaf
Feb 23 at 21:43
I haven't experimented to know for sure, but you could also try capital-U
User
instead ofuser
... reference– Jeff Schaller
Feb 23 at 21:50
1
Capital-U! Thanks @JeffSchaller! Service is working now under
jackett
user.– AlGallaf
Feb 23 at 21:53