0

If I'm working in an interactive shell of any user, an inode list query for /home returns:

[postgres@localhost ~]$ ls -ild /home
2 drwxr-xr-x 14 root root 4096 May 20 16:20 /home

However, a script called in a systemd unit file by an ExecStartPre= clause, and specified to run as a specific user (i.e. User=postgres), which runs the same ls command shown above, displays a completely different inode and fails, stopping me from running the systemd unit normally:

10364 d--------- 2 root root 40 May 20 15:06 /home

I don't really have a clue why is this so. It is actually very strange. Can somebody explain what's going on?

Luis E.
  • 841
  • 11
  • 15

1 Answers1

0

The stock form of the systemd unit file I was trying to access includes the ProtectHome=true clause, which as per the systemd documentation:

ProtectHome=
       Takes a boolean argument or "read-only". If true, the directories /home, /root and /run/user are made inaccessible and
       empty for processes invoked by this unit.

Changing the clause to false made /home available to the script.

Luis E.
  • 841
  • 11
  • 15