Linux – Locked out of ssh, with no root access

linuxremote-accessssh

So, I have configured my linux ubuntu 14.04 box for ssh on port 22 with root login via private / public key, no password login.

I have iptables setup to block all incoming connections except for port 22, and the loop back interface. I inadvertently changed the SSH port to a new port (not 22).

I don't have physical access to the box. Is my only choice just to re-image the box?

Best Answer

If your iptables rule was temporary, you could try a reboot. Else, you would need console access to the machine, in which you could boot into single user mode and change it back. Otherwise, you have effectively firewalled yourself out and would need to re-image if you can't get a console.