LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Locked myself out from ssh access on a RPi4 (https://www.linuxquestions.org/questions/linux-networking-3/locked-myself-out-from-ssh-access-on-a-rpi4-4175727776/)

bomberb17 08-06-2023 08:18 AM

Locked myself out from ssh access on a RPi4
 
While I was configuring wireguard, I ran the command

Code:

sudo ufw allow 51820/udp
However I assume that I also had to run

Code:

sudo ufw allow 22/tcp
Now after reboot I locked myself out of ssh access.

My RPi is headless and I don't have HDMI/keyboard, but I can mount the disk to my ubuntu laptop.
I was thinking that I could somehow configure the firewall and open port 22 again by editing a file in the disk, is it possible?

smallpond 08-06-2023 09:09 AM

I don't have my RPi handy at the moment, but to disable firewalld, I think you can delete the symlink:

/etc/systemd/system/multi-user.target.wants/firewalld.service

This is the equivalent of doing:

sudo systemctl disable firewalld

reenable the firewall after it's up and you have fixed up the entries.

bomberb17 08-06-2023 01:11 PM

Quote:

Originally Posted by smallpond (Post 6446647)
I don't have my RPi handy at the moment, but to disable firewalld, I think you can delete the symlink:

/etc/systemd/system/multi-user.target.wants/firewalld.service

This is the equivalent of doing:

sudo systemctl disable firewalld

reenable the firewall after it's up and you have fixed up the entries.

Actually I had to delete ufw.service, but this solution worked, thanks!


All times are GMT -5. The time now is 12:00 PM.