UFW apparently causing SSH to timeout despite specific rule
0
votes
0
answers
1127
views
I'm new to SSH and ufw and would like to understand why one type of rule works between two Linux Mint computers on the same home LAN but another does not seem to work.
I just wanted to allow one computer to SSH into the other. To start with I checked that it does work if both firewalls are disabled and I can also see that SSH is using the default port 22.
Then, using the following example local IP addresses
10.0.0.2 primary machine - where I want to be sitting and typing in the eventual SSH session
10.0.0.7 remote machine - the one that I'm logging into remotely
**ATTEMPT #1** I set up this rule on the remote machine and left the firewall on the primary machine disabled:
sudo ufw allow from 10.0.0.2 proto tcp to any port 22
but without luck (i.e. SSH times out).
**ATTEMPT #2** I then deleted that rule and tried being even more specific - I entered a rule through gufw with "sudo ufw status numbered" showed as
To Action From
-- ------ ----
[ 1] 10.0.0.7 22 ALLOW IN 10.0.0.2 22
also with no SSH access.
**ATTEMPT #3** Finally I reset it again and instead used
sudo ufw allow 22/tcp
and this finally allowed SSH access. It also works if I re-enable the primary machine's firewall using the default home setting.
QUESTION 1 So, I get it that the last rule attempt is much less restrictive but I don't see what was wrong with either of the first two attempts.
QUESTION 2 Also, in my travels accross the web I've noticed that attempt 3 is quite commonly advised. In my beginners worldview it seems to me that something that only does exactly what I want and no more should obviously be safer so I don't understand why such a wide open approach is recommended.
Asked by Puffin
(101 rep)
Feb 12, 2023, 01:30 AM
Last activity: Feb 12, 2023, 02:02 AM
Last activity: Feb 12, 2023, 02:02 AM