I cant ssh to my debian server

I have a server protected with a private key that i can connect to using the key and the hostname on windows but it doesnt work on linux. my private key aws generated on windows but I converted to from a .pkk to a .pem. I put the .pem key in ~/.ssh and I changed the permissions. when I try to ssh, nothing happens for awhile then it just times out. any help would be appreciated.

Can openssh use a pem format key?

Did you add the keys to your config file so it knows which key to use for your host?

1 Like

you can also add -v or -vv or even -vvv as cli parameters to ssh to get more to insanley much debug info to see where it fails

Also, if it’s a local server, try the IP instead of the hostname. That could eliminate the potential problem of not resolving the address correctly.

Is a firewall blocking the connection?

Did you check the sshd-logs (via Win)?

What about new keys (for linux)? And transfer them via Win?

/var/log/auth.log does not exist and when i try journalctl -u sshd | tail -n 100 i get – No entries –

I made new keys with openssh keygen but that didnt work for linux either ( did work on windows)

I tried using both the hostname and the ip but no luck

when I run ssh with -vv flair using hostname i get

debug1: OpenSSH_10.0p2, OpenSSL 3.5.2 5 Aug 2025
debug1: Reading configuration data /home/asolgat/.ssh/config
debug1: /home/asolgat/.ssh/config line 1: Applying options for raspberrypi
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
debug2: resolving “raspberrypi” port 22
debug1: Connecting to raspberrypi [143.244.220.150] port 22.

until it times out then with the actual ip i get

debug1: OpenSSH_10.0p2, OpenSSL 3.5.2 5 Aug 2025
debug1: Reading configuration data /home/asolgat/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
debug2: resolve_canonicalize: hostname 192.168.6.128 is address
debug1: Connecting to 192.168.6.128 [192.168.6.128] port 22.

till it times out

both the hostname and ip work for ssh on windows

(sorry I took so long to respond, I’ve been very busy)

I installed openbsd-netcat the it worked once and it went back to the same problem it waas having before.

A timeout to a port usually means the port in the local firewall is not open if you are running it locally and otherwise you are running into it being blocked elsewhere. Is there even anything running on port 22 on your Debian server?

when i try journalctl -u sshd | tail -n 100 i get – No entries –

I would understand this, that your server (sshd) does not see any login-attempt. Is your (working) Win-client on the same machine (as your new linux) and has the same net-config?

Can you ping your server from your new linux-client (i.e. get a ICMP-answer)?

My windows and linux are on the same computer, different drives. The weird thing is I was able to connect my my server yesterday but after i exited the session I was no longer able. It was random and I dont think I changed anything when it did end up working.

no

You need to start the ssh service first if nothing is running on port 22 on the Debian server.

reminds me of a weird problem had in the past where I could ssh with the ip but not with the hostname (although it resolved to the same ip)

I could connect after I deactivated local firewall with sudo systemctl stop firewalld.service

You could try this to check it it’s a firewall issue

New ssh keys are best generated by the command ssh-keygen

In your ssh -vv output I see

debug1: Connecting to raspberrypi [143.244.220.150] port 22.

and then

debug1: Connecting to 192.168.6.128 [192.168.6.128] port 22.

This are 2 different IP-addresses.

What is the real address of your ssh-server?