Locked Out!

Spread the love

And so, I got locked out of my own cPanel server. I could not SSH, view a Website, or open the WHM console — I was stuck. It was stupid really. I tried to set up an icon in my file manager so I could access a customer’s FTP account. Except I tried to set it up as an SCP account (I don’t do FTP much). Well, after trying a few times and failing, my server did was I told it do; it locked me out.

Panic set in until I remembered that I’m the system’s administrator and I know stuff. I logged in to another of my servers, connected using SSH, then looked for the deny entry in iptables. Like this:

iptables -L DENYOUT -n --line-numbers | grep 192.168.22.44

Obviously, the IP address up there isn’t really my IP address; it’s there for demonstration purposes. My WHM server has the traditional INPUT, OUTPUT, and FORWARD ip tables, but there’s also a chain for the bad guys whom the system traps. That’s DENYOUT.

The command returned the following.

94   DROP       all  --  0.0.0.0/0            192.168.22.44

That tells me the line number in that chain where my IP is blocked is 94. The next step is to delete that entry.

iptables -D DENYOUT 94

Just like that, all was right with the world.

Liked it? Take a second to support Cooking With Linux on Patreon!
Become a patron at Patreon!