Wednesday, November 4, 2009

HOWTO: SSH Reverse Proxy (Access machine behind firewall)

This will enable an outside user to ssh (or vnc/etc) to a machine behind a restrictive firewall as long as you can ssh (perhaps over http proxy even) to a remote public machine.

#private - the machine behind the firewall
#public - the public machine
#outsider - the person that requires access to #private

from #private

[1] private# ssh -R 9000:localhost:22

from #public

[2] outsider#  ssh

now in that ssh session, #outsider can ssh through the reverse proxy you set up in [1]

[3] user@public# ssh -p 9000 root@localhost

#outsider now has access to #private

HOWTO: Reset linux root password

You'll need to boot into single user mode.

Restart the machine, and go into grub boot loader, may need to press escaoe at the prompt to get to the menu.

At the grub menu select the correct linux boot, press 'e' to modify the boot parameters.
Highlight the line item beginning with 'kernel' press 'e' to edit.
Append ' 1' to the end of the line.

Press 'b' to proceed with boot into single user mode.

You can now use 'passwd' to change root password. shutodwn and reboot.