I have my Rpi4 connected to ethernet headless. It was working fine, but then I notcied it was using default hostname DietPi, hostnamectl gave me errors, so I changed the hostname in /etc/hostname and rebooted the system. Now I cannot get access to it. Getting
Network error: Connection refused
when trying to connect in putty. I am using the correct IP address as confirmed on the router side.
I suspect I did something wrong, but can someone please explain how this could cause the issue? And, more importantly, what is the correct way to change the system hostname?
Samba shares are not working either, so it’s not just SSH issue.
Yes and no, it depends.
For example samba and SSH try to resolve their own hostnames when starting, but your new hostname is not mapped in /etc/hosts so they refuse to start or refuse connection.