You are not logged in.
i cannot connect to my server through ssh when ufw is enabled. ive reset ufw several times just to make sure the appropriate port is open.
a bit more information: i set a custom ssh port in /etc/ssh/sshd_config (obfuscated in below text to be port "22", though when actually trying this with port 22 the issue persists regardless.) ive also put my desktop user's ssh key into the server user's .ssh/authorized_keys file so i dont have to use a password to gain ssh access from my desktop.
(server) "ss -tnlp | grep :22" output:
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:* (server) "ufw status" output:
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
22 (v6) ALLOW Anywhere(host) "ssh -p 22 user@server" output (when ufw is enabled on the server):
ssh: Could not resolve hostname server: Name or service not knownhost connects without issue when ufw is disabled.
im very lost, any help would be appreciated. even if the suggestion is to reset the server and redo everything, if itll work ill appreciate it. ![]()
Last edited by fez (2025-11-16 01:45:47)
Offline
ssh -p 22 user@server" output (when ufw is enabled on the server):
ssh: Could not resolve hostname server: Name or service not known
How is your system intended to determine what IP "server" resolves to?
(server) "ss -tnlp | grep :22" output:
On the server side, running ss without grepping might help diagnose:
ss -A inet -nlpOffline
i found a solution! i figured that ssh wouldve functioned as it did when ufw was off on the server, where ssh 'user@host' works with no additional configuration, however after associating the servers local ip with the hostname (in .ssh/config) im able to ssh with the firewall running.
ive come across this issue before, but i really didnt think it was the case here
.. my bad. thanks for your help!
marking as solved
Last edited by fez (2025-11-16 01:51:39)
Offline