Hi,
Sorry for the delay.
About the keep-alive port, please read up on autossh in the documentation:
autossh(1): monitor/restart ssh sessions - Linux man page
The -M argument opens the port for you, that's all you need to do. It uses it to test that the connection is up. When the connection goes down, it attempts to restart ssh to renew the tunnels. You don't need to open a new port for it on your router, it's part of the tunnels. I simply used the port from the docs, it's arbitrary.
-2 is an ssh argument, please read up on it here:
ssh(1): OpenSSH SSH client - Linux man page
It simply sets the protocol version to SSH2.
-f tells autossh to run in the background.
-N is important, it tells SSH to not start a shell. This goes together with my instructions to set the user shell to /bin/false for added security.
Adding * before the tunnel parameters changes the bind address. It can be necessary if the machine running VNC is not the SSH home server.
-
Running the script at startup is another problem. What you can do is add "touch /var/root/test.txt" to your sh script. That way after boot you can check that the file was created. If it is created you can try adding:
export AUTOSSH_LOGLEVEL=7
export AUTOSSH_LOGFILE=/var/root/autossh.log
That will show what connection errors there are.
Obviously, check the shell script ownership (should be root), should be executable (chmod 755), should be in /bin to be accessed at boot time, check the startup script for spelling, etc...
By the way. The name of the script in my instructions is autohome.sh, calling it simply .sh is not very descriptive.
Regards,
Lionel.