I would like to execute this command
ssh -R 2200:localhost:80 user@"myddns.net"
at every startup of my fedora system (note that the command itself is working in a shell).
I thought to use systemd instead of crond.
I created the file /etc/systemd/user/myssh.service :
[Unit]
Description=Ssh remote for myssh
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
#User=
#Group=
ExecStart=/usr/bin/ssh -R 2200:localhost:80 user@"myddns.net"
Restart=on-failure
StandardOutput=file:%h/log_file
[Install]
WantedBy=default.target
I enabled and started it but the command did not work :
systemctl --user enable myssh.service
systemctl --user start myssh.service
here is some log :
➜ ~ journalctl --user -u myssh
août 28 12:33:06 lausanne systemd[1419]: Started myssh.service - ssh remote for Lausanne.
It may be because ssh -R is an interactive command and not suitable for systemd (or crond). Could still be it done in this way ?