LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2023, 08:18 AM   #1
bomberb17
Member
 
Registered: Jul 2005
Posts: 71

Rep: Reputation: 0
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?
 
Old 08-06-2023, 09:09 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,153

Rep: Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265
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.
 
1 members found this post helpful.
Old 08-06-2023, 01:11 PM   #3
bomberb17
Member
 
Registered: Jul 2005
Posts: 71

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smallpond View Post
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!
 
  


Reply

Tags
firewall, ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I locked myself out of sudo privileges, anyways to save myself? Disaster2life Linux - Newbie 6 09-18-2021 12:41 AM
Completely uninstalling MySQL and its passwords passwords...how? I locked myself out! Baix Linux - Newbie 2 01-30-2005 04:10 PM
Help! Locked myself out of my computer with Netconfig Host Login OldManTrue Linux - Networking 2 06-17-2003 07:26 PM
locked myself out with firewall cuboctahedron Linux - Newbie 4 05-07-2003 03:15 PM
HELP!! I just locked myself out of MySQL!! What an idiot -----------> FunkFlex Linux - Newbie 0 01-27-2002 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration