You are not logged in.
I'm trying to set up minidlna (readyMedia) to run as a user to simplify permissions issues. I've followed the instructions in the wiki and that all seems to be working.
The problem, however, is that I'm running this on a box that's serving as a NAS and I don't want to have to log in to start minidlna (as suggested by the wiki). I tried tweaking the .service file to start it as my user, but that failed - is there a way to run the startup command automatically as a user - without explicitly logging in as that user?
Offline
You can also tell a system service to run as a specified user, post your current service file.
Offline
my service file looks like this:
[Unit]
Description=minidlna server
After=network.target
[Service]
Type=simple
User=minidlna
Group=minidlna
ExecStart=/usr/bin/minidlnad -S
ProtectSystem=full
ProtectHome=on
PrivateDevices=on
NoNewPrivileges=on
[Install]
WantedBy=multi-user.target
Offline
Your ExecStart command doesn't match what is in the wiki to start as a user. Don't you need to specify the config file and pid file to use?
EDIT: oops, I didn't realize the above was not the OP's post. I thought that was a service file that was not working not an additional example of a working one.
Last edited by Trilby (2016-11-20 18:04:43)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I'm using the default location /etc/minidlna.conf and /var/run/minidlna/minidlna.pid
So I'm good with that.
But maybe the OP should post his file like V1del suggested. :-)
Last edited by nambot (2016-11-20 16:12:50)
Offline
OP here - sorry for the delay, but things have been hectic here.
My service file currently looks like:
[Unit]
Description=minidlna server
After=network.target
[Service]
Type=simple
User=paul
Group=users
ExecStart=/usr/bin/minidlnad -f /home/$USER/.config/minidlna/minidlna.conf -P /home/$USER/.config/minidlna/minidlna.pid
ProtectSystem=full
ProtectHome=on
PrivateDevices=on
NoNewPrivileges=on
[Install]
WantedBy=multi-user.target
It's currently failing with:
fatal: Error reading configuration file /home/$USER/.config/minidlna/minidlna.conf
I changed the ExecStart to match what the wiki says.
Edit: I've since tweaked the ExecStart again to
ExecStart=/usr/bin/minidlnad -f /home/paul/.config/minidlna/minidlna.conf -P /home/paul/.config/minidlna/minidlna.pid
, but still ge tthe same error - although with "paul" instead of $USER. I had assumed it would resove $USER to the value of the "User" line. I even tried changing the exec to use $User. but to no avail.
The file in question does exist and is readable by my user.
Last edited by phunni (2016-11-24 16:42:22)
Offline
$USER is a shell variable, so that will not work in service files - more importantly, even if it did expand $USER the uid running the service file is 0 (so USER=root). You will need to use the full path.
Do you have a separate home partition? I suspect the problem with the full path is that your home partition may not be mounted when this first runs.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Set ProtectHome=on to off, since you actually want to access your home directory
Offline
+V1del thanks - that seems to have worked. At least, the server has started properly. I haven't yet had the chance to actually test streaming from it.
Offline
The server starts now, but it's not actually streaming content without error. As this seems to be a different issue, I've started a new thread:
https://bbs.archlinux.org/viewtopic.php … 5#p1672495
please take a look and comment if you can help! Thanks.
Offline
Actually - looking at "systemctl status minidlna" I'm not certain it is starting properly:
● minidlna.service - minidlna server
Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Sun 2016-11-27 20:31:05 GMT; 16s ago
Process: 10836 ExecStart=/usr/bin/minidlnad -f /home/paul/.config/minidlna/minidlna.conf -P /home/paul/.config/minidlna/minidlna.pid (code=exited,
Main PID: 10836 (code=exited, status=0/SUCCESS)
Offline
You copied most of the default minidlna.service, but not the -S command-line switch. It is not very well documented, but it seems to stop minidlnad from forking so it works with Type=simple.
Offline