Running a service on CentOS as a system user other than root












0















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
enter image description here










share|improve this question

























  • @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











  • 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





    Capital-U! Thanks @JeffSchaller! Service is working now under jackett user.

    – AlGallaf
    Feb 23 at 21:53
















0















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
enter image description here










share|improve this question

























  • @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











  • 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





    Capital-U! Thanks @JeffSchaller! Service is working now under jackett user.

    – AlGallaf
    Feb 23 at 21:53














0












0








0








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
enter image description here










share|improve this question
















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
enter image description here







centos systemd root services not-root-user






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 23 at 21:38









Jeff Schaller

43.4k1160140




43.4k1160140










asked Feb 23 at 20:59









AlGallafAlGallaf

113




113













  • @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











  • 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





    Capital-U! Thanks @JeffSchaller! Service is working now under jackett 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 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








  • 1





    Capital-U! Thanks @JeffSchaller! Service is working now under jackett 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










1 Answer
1






active

oldest

votes


















0














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






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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






    share|improve this answer




























      0














      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






      share|improve this answer


























        0












        0








        0







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 23 at 21:55









        Jeff SchallerJeff Schaller

        43.4k1160140




        43.4k1160140






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?