Page 1 of 1

[Solved] SSH troubles: Connection refused

Posted: 2024-12-24 14:07
by NotreTerre
Hello everyone,

First of all, thank you for accepting my account to join the community. I’m looking forward to all I can learn through it. I use Debian and code as a hobby. I am a beginner. My goals are to create my own home server in order to hold and share data for my personal and professional use. I would like to be able to evolve as I learn and be able to even host my own website but it all depends on the complexity and time invested. So thank you in advanced to all you who share your experiences and knowledge to help me progress in my endeavors!

Today I have installed Debian 12 using an old computer that I had lying around. For now the processor and memory is all bare minimum, but I will be upgrading in the near future. More details will be shared in the future of my setup, for now I’d just like to resolve my SSH connection issues.

After a fresh install following the careful instructions found on YouTube, I successfully setup and connected to my server via SSH with key. I was having no trouble until I installed UFW on my own in hopes to increase security. We I carefully configured to allow the custom port i had set up during the hardening process, but now I can no longer connect through SSH.

I’ve checked all statuses, restarted, I even disabled my UFW in hopes of tracing back my steps to when things were working properly, but it seems irreversible. I’ve looked up many troubleshoots and have tried checking all I could find but to no avail. I know I must be missing something, perhaps something overly simple (besides typing in the wrong user or address, I’ve double checked a dozen times).

I’m also probably forgetting to include important information that you all may need to help me solve my problem, sorry in advance. Please just let me know and I’ll include whatever information is missing.

Anyone have some ideas to share? I’ve gone through every test I could find on the internet to get back up and running. Please share your thoughts!

Thanks!

Re: SSH troubles: Connection refused

Posted: 2024-12-24 14:30
by arzgi
Hello and welcome!

Debian wiki is a good resource for Debian users, check this https://wiki.debian.org/SSH, If you still have trouble after reading and trying what wiki suggest, ask more.

Re: SSH troubles: Connection refused

Posted: 2024-12-25 21:52
by NotreTerre
Hello, thank you for your response.
It’s true the wiki page for Debian is full of great resources, but it hasn’t helped me troubleshoot this particular problem. I went through the entire wiki ssh page double checking all of my entries but I haven’t yet found the solution.
I realized however that I can no longer find the key that I saved in the .ssh/authorized_keys file. I’m wondering if that may be the issue, but then again the error message I receive when trying to connect doesn’t mention any failures to connect through key authentification but rather a general refusal to connect. I’m getting to the point where I might just reinstall the entire OS..

Re: SSH troubles: Connection refused

Posted: 2024-12-25 23:28
by lindi
Use tcpdump to see if traffic arrives on port 22?

Re: SSH troubles: Connection refused

Posted: 2025-01-05 06:35
by ZanyScum
I would remove ufw and test if ssh works again.
If it works again, then you know you did apply the ufw rule in a wrong way.
If it does not work again, the problem is - probably - not with ufw. But it is not a productive system, so I'd leave any firewall deactivated until ssh works properly (again).

Re: SSH troubles: Connection refused

Posted: 2025-01-09 02:40
by friendlysalmon88
It'd help us to further assist the OP if they where to either use the code tags here on the post logs files from the effected machine. I do believe that said logs can be found under the directory structure listed bellow.

/var/log/sshd

Re: SSH troubles: Connection refused

Posted: 2025-01-09 03:23
by CwF
friendlysalmon88 wrote: 2025-01-09 02:40 /var/log/sshd
As usual you need to brush up on reality and think a bit before posting.

Re: SSH troubles: Connection refused

Posted: 2025-01-23 21:22
by NotreTerre
Sorry for my absence, I did get ssh working again. It was a bit of a pain but in the end it was simply because I was mixed up between host machine and my remote device between authentication. Another rookie move! But please be patient, there will be more...

Re: SSH troubles: Connection refused

Posted: 2025-01-25 15:34
by Aki
NotreTerre wrote: 2025-01-23 21:22 Sorry for my absence, I did get ssh working again. It was a bit of a pain but in the end it was simply because I was mixed up between host machine and my remote device between authentication. Another rookie move! But please be patient, there will be more...
I'm glad you sorted it out. :)

Please, mark the discussion as "solved" manually adding the text tag "[Solved]" at the beginning of the subject of the first message (after other tags, if any).

Thanks.

EDIT Sat Feb 1 12:40:31 CET 2025: added solved tag. Moved to "System and Network Configuration" sub-forum.