Skip to content

Instantly share code, notes, and snippets.

@illiafox
Created September 2, 2024 09:58
Show Gist options
  • Save illiafox/839c7e21e655dd0ee262227fb20fca98 to your computer and use it in GitHub Desktop.
Save illiafox/839c7e21e655dd0ee262227fb20fca98 to your computer and use it in GitHub Desktop.
How to manually edit ufw to open ssh port

Problem: you enabled ufw on your RaspberryPi or OrangePi, but forgot to open the 22 port (rookie mistake)

Solution: manually edit ufw rules

  1. Eject sd card, connect it to your pc and mount into some directory
  2. Find /etc/ufw/user.rules
  3. Add these lines
### tuple ### allow any 22 0.0.0.0/0 any 0.0.0.0/0 in
-A ufw-user-input -p tcp --dport 22 -j ACCEPT
-A ufw-user-input -p udp --dport 22 -j ACCEPT
  1. Insert sd card in RaspberryPi or OrangePi
  2. Boot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment