Page 1 of 1
Running CMX as a service but not as root?
Posted: Wed 28 Jun 2023 4:30 pm
by broadstairs
Has anyone here got CMX running as a systemd service in Linux but not running as root?
My reasoning is that I need the CMX data files to be user files so other programs which run can access the files, simply altering the permissions on the data files is no good as I need this whole system to restart on a power failure or continue over month change etc (new data file(s) ) with no user intervention. Running these other programs as root is not acceptable.
Stuart
Re: Running CMX as a service but not as root?
Posted: Wed 28 Jun 2023 4:46 pm
by HansR
Hi,
I run CMX as service under user pi with the following systemd script:
Code: Select all
[Unit]
Description=CumulusMX service
Documentation=https://cumuluswiki.org/a/Main_Page
Wants=network-online.target
After=network-online.target
Wants=time-sync.target
After=time-sync.target
[Service]
User=pi
Group=pi
ExecStart=/usr/bin/mono-service -d:/home/CumulusMX CumulusMX.exe -service
Type=forking
ExecStopPost=/bin/rm -f /tmp/CumulusMX.exe.lock
[Install]
WantedBy=multi-user.target
I changed user/group for all files in the CMX tree to:
pi/pi and everything works fine.
The side effect is that it is easy to update through e.g. WinSCP when that tool logs in as pi. No more use as root which is disadvised always. I only use root through
sudo, rarely through
sudo su.
And of course you can use any user you wish and install CMX in any directory you wish.
Safety first.
Re: Running CMX as a service but not as root?
Posted: Wed 28 Jun 2023 5:19 pm
by broadstairs
Thanks for that. I was intending to user my user group as stuart/user for example as that is the user which runs the other apps. Now the other apps only need read access so if they get that I should be OK. I'll try using stuart/user and see what happens as I don't want the CMX files under another user/group if I can help it.
Stuart
Re: Running CMX as a service but not as root?
Posted: Sun 02 Jul 2023 5:56 pm
by broadstairs
Just to confirm now I have CMX running as a service using my user and group. All working fine.
Stuart