I have an OpenVZ VPS server with Debian. I just setup IPTables to allow the SSH port rebooted it. (Also set the rules to auto load on startup). Now I can't login to the server! How to fix this?

Note : The SSH port is set to 325

Here are the rules :

    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:325 
    DROP       all  --  anywhere             anywhere            

    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination  

Well, looks like you didn't get that SSH allow rule in there correctly, did you?

At this point, you really only have two options:

  1. Employ your VPS provider's OOB console to sign into your VPS. This would bypass the network stack. The problem here is that not all VPS providers give you access to the actual console of your server.
  2. Boot some sort of recovery distro, mount your filesystem, and fix your iptables rules. Being that this is an OpenVZ "VPS", though, it's unlikely that this is even possible.

So - contact your provider. They may unfortunately be the only ones that can dig you out of this hole.

| improve this answer | |
  • Unless by some weird chance you set your ssh server to run on port 325, in which case you could ssh in using the port option: ssh foobar.com -p 325 – jpgeek Nov 8 '12 at 5:20
  • Yes, the SSH port is set to 325. But still can't login :( – THpubs Nov 8 '12 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.