Added autossh in rc.local, but the dynamic port forwarding won't work

Posted by rankjie on Server Fault See other posts from Server Fault or by rankjie
Published on 2012-10-21T04:07:43Z Indexed on 2012/10/21 5:07 UTC
Read the original article Hit count: 300

Filed under:
|
|

I am using Rasbian on my newly arrived Rasp.Pi, and decided to make it my own proxy server.
Now I need to set up a ssh tunnel on the Pi to my Linode server, and make it auto start with the system.

What did I do:

  • Add this line to /etc/rc.local

    autossh -f theRemoteServer -N -D 5555 -L 1234:localhost:22

After I reboot, I found out that I can't use the localhost:5555 as a socks proxy. So I type the command ps -A | grep ssh then I can see the autossh and ssh all running:

pi@raspberrypi ~ $ ps -A | grep ssh
2018 ? 00:00:00 sshd
2116 ? 00:00:00 autossh
2119 ? 00:00:00 sshd
2195 ? 00:00:00 sshd
3173 ? 00:00:00 ssh

(I've installed autossh, and the command works if I type it manually.) (I use the passwordless key auth, so I don't have to enter password.)

Much appreciated and sorry for my poor English.

© Server Fault or respective owner

Related posts about ssh

Related posts about debian