-
Notifications
You must be signed in to change notification settings - Fork 15
Running WebTunnelAgent as User with systemd
Günter Obiltschnig edited this page Jul 19, 2023
·
1 revision
It's possible to run WebTunnelAgent
as a normal user as a systemd
service, without requiring sudo
privileges.
The following instructions are for an Ubuntu 22.04 system, but should work on other systemd
-based distributions.
mkdir -p bin etc var/log
curl https://macchina.io/downloads/RemoteManager/SDK/ubuntu/22.04/x86_64/WebTunnelAgent.gz >bin/WebTunnelAgent.gz
gunzip bin/WebTunnelAgent.gz
chmod +x bin/WebTunnelAgent
Enable logging to file in the configuration file:
logging.loggers.root.channel = file
logging.channels.file.class = FileChannel
logging.channels.file.pattern = %Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.file.path = ${system.homeDir}var/log/${application.baseName}.log
logging.channels.file.rotation = 100K
logging.channels.file.archive = number
logging.channels.file.purgeCount = 3
[Unit]
Description=WebTunnelAgent
After=syslog.target network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=/home/user/bin/WebTunnelAgent --config=/home/user/etc/WebTunnelAgent.properties
[Install]
WantedBy=default.target
Note: replace /home/user
with your home directory.
systemctl --user daemon-reload
Without this, the service will only run while the user is logged in, which is not what we want.
loginctl enable-linger $LOGNAME
systemctl --user enable --now WebTunnelAgent.service