Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I had my server set up to accept SSH connections on port 21966, I followed some steps to configure ufw however it has now locked me out of all SSH access on any port!

I've been able to boot my server into 'rescue' mode, providing me with an SSH rescue account, through which I am able to mount the hard drives and see my files. I do not know what to do from here, as the ufww service isn't running so I cannot disable it or uninstall.

share|improve this question
Have you write access to config files? If so, this might be helpful. –  doz10us Feb 21 at 4:35
yes, but I don't know what to write! –  James Feb 21 at 14:56

1 Answer 1

up vote 3 down vote accepted

Your ufw rules should be located in /lib/ufw/user.rules config file. Modify that file so that somewhere between ### RULES ### and ### END RULES ### section there are the following entries:

### tuple ### allow any 21966 any in
-A ufw-user-input -p tcp --dport 21966 -j ACCEPT

Additionally make sure that your /etc/ssh/sshd_config file has Port 21966 entry(instead of port 22).

share|improve this answer
Thank you, how does one adjust it to allow an SSH connection on port 21966? –  James Feb 21 at 14:54
@James see my updated answer. –  Mxx Feb 21 at 16:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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