These scripts can be used to enable a persistent reverse ssh connection from a host to a relay. The host box initiates a reverse ssh connection to the relay box, and a user can access the host through the relay.
must have openssh-server and autossh installed
only need to edit the four parameters at the top of the file
It will
- add an ssh key pair in /etc/sshtunnel
- create a script to run a systemd service in /etc/systemd/system/sshtunnel.service
- start the sshtunnel service
- Display the public key generated in step one. This should be copied and kept for the relay setup
It will
- make a user named sshtunnel
- create an empty authorized_keys file in /home/sshtunnel/.ssh/authorized_keys
open the authorized keys file on the relay machine
relay-machine $ sudo nano /home/sshtunnel/.ssh/authorized_keys
paste in the public key you copied while setting up the host
To access the host machine use the following ssh parameters
Hostname localhost
Port [reverse port you entered while editing host_setup.sh]