Raspberry Pi SSH

Hello!

I’ve installed AlmaLinux 9.2 onto a Raspberry Pi (a USB SSD rather than flash card, if it makes any difference).

But I can’t login to it via SSH. Unlike the other post I found that sounded similar, my problem is that the SSH connection is refused immediately.

I run ssh almalinux@ip-address and it just says connection refused, without any noticeable delay. It doesn’t even reach the password prompt, and doesn’t matter what username I try - same result.

My thinking is maybe the connection is being blocked by firewall, or something like that? But how to fix this?

I can access the SSD on another machine so I can modify config files if necessary, but unsure where to start.

I’m kind of new to Raspberry Pi - maybe AlmaLinux is aimed at more advanced users and I’d be better starting with something else? But I’d like to try learning, if there’s something obvious I’m missing (and I feel like I must be missing something!).

Are you sure the RPi is online? Can you ping its IP address, or does that just time out?

If this is your very first time getting an OS running on a Pi then I highly recommend connecting a local display, at least to verify basic functionality etc.

Disclaimer: I’ve not tried AlmaLinux on a Pi yet

There are lots of things that can go wrong.

First of all - let me echo LinuxGuy’s recommendation to connect a physical display and keyboard. Then you an go spelunking in the logs with journalctl. Nowadays pretty much all logs are concentrated there in a non-humanly-readable format.

But one thing you can do before that is to add -v (or even -vv or -vvv) to the ssh command. That will in many cases tell you why the connection was refused.

You need to add ssh key from client for login to user data file before first boot. It works with me on almalinux 8.8.

Thank you all for your help. And especially, for your patience dealing with a newbie.

Plugging in the screen, I saw that sshd didn’t start. In journalctl it said no hostkeys was the reason, which required sudo ssh-keygen -A to generate.

User almalinux wasn’t in sudoers, and root login disabled, but I sorted that by adding to wheel in /etc/group with the drive mounted on another machine, and was then able to generate the keys as sudo.

Still not able to ssh in, because it doesn’t seem to be accepting my ssh key (generated both rsa and ed25519 on my client machine but neither one seems to do the trick in the user-data file), but I will keep playing and reckon this should be solvable now that I have some actual error messages to go on!

Thanks again.