Andy Smith <[email protected]> wrote:
> Hi,
> 
> On Fri, Feb 27, 2026 at 10:26:08AM +0000, Chris Green wrote:
> > I have several systemd services which I want to run as a user (i.e.
> > not root) but I do want them to run at start-up whenever the system is
> > rebooted.
> 
> User services normally only start when the user logs in for the first
> time, and are terminated when the last login session of the user ends.
> 
> If you would like fore there to always be a session of that user
> existing (so all of that user's services start at boot and remain
> running), you can enable "linger":
> 
> $ loginctl enable-linger
> 
> If the service in question is not strictly user-based then I would
> probably run it as a system service with User=. e.g. a daemon that you
> expect there to only be one of on the system, that runs under a specific
> user for that daemon, would make more sense as a system service, whereas
> something that runs on behalf of a specific real user (and there might
> be other instances of per-user) does make sense as a user service.
> 
Thank you Andy.  I think enable-linger may well be just what I want
for some services.

This is a small system that is on a boat in France, it drives some
displays on the boat and also allows for remote monitoring of battery
voltages and such.

The systemd services in question are of two types:-

1 - A collection of outgoing ssh connections which set up reverse
tunnels so that I can log in to the system using ssh from home. (The
system on the boat is behind a CGNAT mobile connection). 

2 - Some python programs that run the displays on the boat.

Neither of the above need root access but I do want them to run
whenever the system is on, not just when I'm logged in.

-- 
Chris Green
ยท

Reply via email to