0

I need to connect to my office computer through ssh, but all the ports are blocked and there is nothing to do there. I'd like to connect with reverse SSH tunneling. For that I want to use an external server that it's always on, and I want to set up my office computer to run the ssh command right at boot (before login).

I tried by modifying /etc/rc.local. These are the permissions:

-rwxr-xr-x 1 root root 385 nov  2 17:27 /etc/rc.local

The file:

#!/bin/sh -e
#
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sleep 1
sshpass -p 'pass' ssh -N -R 9091:localhost:22 user@server &
exit 0

Running /etc/rc.local allows me to connect from my home computer to my office computer, so the code does what it's supposed to, but it doesn't seem to do anything while booting.

Any ideas how to make the script run during booting?

Thanks.

Javier GB
  • 1
  • 1

0 Answers0