Page 1 of 1

Permissions for Serviio without root

PostPosted: Mon Apr 28, 2014 11:46 pm
by gkozto
Hi,
I've run Serviio before as root, and now when I start the service as normal user, I can't play anything (I get "file not supported" error for every file). Everything works, when I start serviio as root. I guess when I first ran serviio as root, I changed permissions for some files, and now I can't reach the database files without superuser permissions. My question is, which are the files I need to change the permissions for, and what permissions should I use? I'm using Kubuntu.

Thanks.

Re: Permissions for Serviio without root

PostPosted: Thu May 01, 2014 7:03 pm
by zip
there should be some tips in the Linux section on the wiki.

Re: Permissions for Serviio without root

PostPosted: Fri May 02, 2014 8:07 am
by Luckyfriend222
I'm running Serviio on Fedora 20.

What I did was, all my files on local disk have normal user permissions, say, for Larry. So file's permission is 664 (rw-rw-r-- larry larry). Then under the installation instruction for serviio, there is a section where you specify user to run serviio as, there I put root in, to ensure that all is working.

4a.Fedora >= 15 - Systemd script

Create the systemd script /lib/systemd/system/serviio.service with the following code: (If content library is available via nfs or cifs, add remote-fs.target in After=)

[Unit]
Description=Start the serviio DLNA server in headless mode
After=local-fs.target network.target

[Service]
Type=simple
User=root
ExecStart=/opt/serviio/bin/serviio.sh
ExecStop=/opt/serviio/bin/serviio.sh -stop
Restart=on-abort

[Install]
WantedBy=multi-user.target


This is according to installation instructions found @ http://wiki.serviio.org/doku.php?id=howto:linux:install:fedora

This setup works for me. Serviio doesn't physically change file permissions of files added to the library, so making the user root should not have a problem. It seems that your files on your file system is physically your problem. Their permissions, and ownership, should be set to normal user.

Hope this helps!

Re: Permissions for Serviio without root

PostPosted: Fri May 02, 2014 12:08 pm
by gkozto
Luckyfriend222 wrote:I'm running Serviio on Fedora 20.

What I did was, all my files on local disk have normal user permissions, say, for Larry. So file's permission is 664 (rw-rw-r-- larry larry). Then under the installation instruction for serviio, there is a section where you specify user to run serviio as, there I put root in, to ensure that all is working.



Thank your for your answer. I understand you're running serviio as root. Is this mandatory? I'd like to run serviio as a normal user without root.

Re: Permissions for Serviio without root

PostPosted: Fri May 02, 2014 12:18 pm
by Luckyfriend222
gkozto wrote:
Luckyfriend222 wrote:I'm running Serviio on Fedora 20.

What I did was, all my files on local disk have normal user permissions, say, for Larry. So file's permission is 664 (rw-rw-r-- larry larry). Then under the installation instruction for serviio, there is a section where you specify user to run serviio as, there I put root in, to ensure that all is working.



Thank your for your answer. I understand you're running serviio as root. Is this mandatory? I'd like to run serviio as a normal user without root.



According to other users (some on this forum) you should not run it as root. The setup as I've mentioned above worked the best for me. I also had problems with "file not supported", which turned out to be permissions. Therefore the actual Serviio service gets run as root. The installation folder under opt is still owned by normal user.

Re: Permissions for Serviio without root

PostPosted: Fri May 02, 2014 8:27 pm
by grolschie
My current setup:
serviio is run as user: serviio
serviio is a member of group: dlna
media folders and serviio install folder are owned by: user=[my username], group=dlna
media folders have permissions: drwxr-x--- i.e. chmod -R 750
serviio install folder has permissions: drwxrwx--- i.e. chmod -R 770


This allows me to freely access the media files, and serviio has read access to them. Serviio being a member of group dlna has write access to it's own install folder.

The only problem I have is that files created by serviio (e.g. log files) are owned by serviio:serviio, so I need to chmod or chown them to view them.

Re: Permissions for Serviio without root

PostPosted: Sun May 04, 2014 7:47 pm
by gkozto
Thank you for your help, I'm running serviio with it's own user now, permissions are much better this way.

Here's what I did step-by-step, if anybody needs it:
  • created new user serviio and new group dlna
  • added the normal user and serviio user to dlna
  • changed serviio install folder owner group to dlna, and permissions to drwxrwx---
  • changed media folder owner group to dlna, and permissions to drwxr-x---
    My media files were on an NTFS partition, so I had to change the permissions in the fstab file. Also, Kubuntu normally mounts the drive under /media/[username]/[drive-label], user serviio can't reach this.
  • created a home directory for user serviio, because I was getting error messages without it.
  • used visudo, so my old user can use sudo to start the service as user serviio
  • started the service as user serviio from a bash script with this command (setting the language too):
      Code:
    sudo --user serviio --set-home /bin/bash -c "
          LANG=\"hu_HU.utf8\";
          SERVIIO_HOME=/path/to/serviio;
          source /path/to/serviio/bin/serviio.sh"