0

I connected to Ubuntu server from my Mac terminal using ssh root@555.555.55.55 (not the real IP address), then I got an error ssh: connect to host 555.555.55.55 port 22: Connection refused. After that I tried the command ssh root@555.555.55.55 -p 55555, then I got the message root@555.555.55.55: Permission denied (publickey).

Before changing the port number I have installed ufw and I changed the port number using sudo nano /etc/ssh/sshd_config.

Now I'm not able to connect to my server. Can anyone help me out.

Artur Meinild
  • 21,605
  • 21
  • 56
  • 89
  • 1
    "*Permission denied (publickey)*" suggests that you DID connect to port 55555. You were refused entry due to incorrect login. Try again using `ssh -v root@555.555.55.55 -p 55555` for more useful diagnostic output. – user535733 Nov 06 '22 at 14:29
  • 1
    Is the server on the same LAN as the MAC? if not, you likely need to change the port forwarding settings on the server network's router if you want to use a different external port number – steeldriver Nov 06 '22 at 14:42
  • FYI you are not going to be able to login as root on a default Ubuntu system. That's disabled by default, and since the `root` password is not set you need to use SSH public key authentication to login to `root` by default. You should SSH in as a non-root sudo-enabled account and then use `sudo` on your sudo-enabled account to execute commands as admin. – Thomas Ward Nov 06 '22 at 18:26
  • Does this answer your question? [SSH Permission denied (publickey)](https://askubuntu.com/questions/311558/ssh-permission-denied-publickey) – Artur Meinild Nov 15 '22 at 07:47
  • 1
    @Dan I think you have to see the IP address as an abstraction in the question.. I understand why the OP doesn't want to show his real public IP and port here. – Artur Meinild Nov 15 '22 at 08:00

0 Answers0