Ubuntu Notes: Set up autossh as systemd useful-reminder commands

 sudo vim /etc/systemd/system/permanentAutossh.service

========================================

[Unit]

Description=Keeps a tunnel to myOciFreeNat open

After=network-online.target


[Service]

User=<username>

Environment="AUTOSSH_GATETIME=0"

ExecStart=/usr/bin/autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L 4322:127.0.0.1:5432 -i /<ssh_private_key_file_absolute_path> <username>@<ip_address> -p 22


[Install]

WantedBy=multi-user.target

========================================

sudo systemctl daemon-reload

sudo systemctl enable permanentAutossh

sudo systemctl start permanentAutossh

==================

sudo systemctl daemon-reload

sudo systemctl restart permanentAutossh

sudo systemctl status permanentAutossh

======================

sudo systemctl stop permanentAutossh

sudo systemctl disable permanentAutossh

sudo rm /etc/systemd/system/permanentAutossh.service

No comments:

Post a Comment

If you have any doubts, please let me know.

Regarding site Free Browser Tool (https://free-browser-tools.mohitkrgupta.dev) (discussion with google search AI)

Various discussions with Google Search AI regarding site  Free Browser Tool are as below: site free-browser-tools.mohitkrgupta.dev what doe...