I have as file sync script I want executed periodically every 1 min or so. Since I may need separate instances for different users I run it as a user instead of root. The issue I have is that it seems only executed when logged in. That is the timer is started and remains started but the script does not execute until the moment I enter user/pass in the terminal or am already logged in. Why does this happen? What is causing it and how to make it run in the background like any other systemd timer?

Systemd service:




Systemd timer:




Timer start command:

systemctl --user start *******.timer
  • 4
    You likely need to enable lingering for that user, otherwise the timer will be started when the user logs in (and gets an active session).
    – Olorin
    Oct 15, 2018 at 8:24
  • @Olorin That appears to have fixed the issue, Thanks!
    – DominicM
    Oct 15, 2018 at 9:10
  • @Olorin Maybe you can shed some light on one thing for me, is there a way to start --user services from a different account such as root? I don't mean run it as root just start it from root account by specifying x username. I know about services with @ notation but if I understand correctly these services can only be started by root. It would be nice to be able to do both if it's possible.
    – DominicM
    Oct 15, 2018 at 9:33
  • Do you mean something like unix.stackexchange.com/a/245866/70524? Also, any user can make use of the @ notation. All you need to do is name the unit with a @ (foo@.service, for example), and use %i/%I inside the unit. %i/%I will be replaced with the part after the @.
    – Olorin
    Oct 16, 2018 at 1:53
  • I was thinking more of a standard systemd way as opposed to running as user with -u. I've seen another thread that stated only root can run @ notation units. Can you clarify that running for example "systemctl start test@user.service" should work exactly the same whether it is run by root or "user" account? Do I also need to specify username even if running as desired user or is there a shorthand to run as current user?
    – DominicM
    Oct 16, 2018 at 7:40


Browse other questions tagged or ask your own question.