Systemd service can’t access user home

systemd

I am trying to setup a systemd service on Ubuntu 15.04 (and Debian 8). I have a program /home/testuser/server/prrserver. My systemd service is configured to run prrserver as testuser:testuser. What the prrserver does is start a new process /home/testuser/server/prrproc which reads some files in /home/testuser/server/data. What is interesting is that prrserver starts OK and prrproc starts OK but prrproc complains that there is no such file /home/testuser/server/data/foo which otherwise exists. If I start my server from the command line, it finds the file. Any idea what could be wrong? Maybe when prrserver forks a new process, the new process doesn't run as testuser anymore and for some reason can't access the testuser directory (even though it's permission allow this)?

[Unit]
Description=PRR Server

[Service]
Type=simple
User=testuser
Group=testuser
ExecStart=/home/testuser/server/prrserver

[Install]
WantedBy=multi-user.target

The status is something like this:

systemctl status prrserver.service
    â prrserver.service - PRR Server
   Loaded: loaded (/lib/systemd/system/prrserver.service; enabled; vendor preset: enabled)
   Active: active (running) since mån 2015-05-25 14:50:42 CEST; 1min 2s ago
 Main PID: 21205 (prrserver)
   CGroup: /system.slice/prrserver.service
           ââ21205 /bin/sh /home/testuser/server/prrserver
           ââ22101 /bin/sh /home/testuser/server/prrproc

maj 25 14:50:42 ubuntu-dev systemd[1]: Started PRR Server.
maj 25 14:50:42 ubuntu-dev systemd[1]: Starting PRR Server...
maj 25 14:50:53 ubuntu-dev prrserver[21205]: PRR Server started listening on port 10239

Note that the main process prrserver launches the prrproc processes and the problem is with the prrproc processes so the status of the service is green.

Best Answer

In theory it could be private mount namespace. It's a security feature. I guess you could try ruling it out with

ProtectHome=off