1

I want to connect to remote server through Ubuntu shell. I am using ssh root@serverIP in Ubuntu shell but I receive this msg:

connect to host xxx.xxx.xx.xx port 22: Connection refused

This IP is on port 30 not 22. I have also changed the port by using sudo gedit /etc/ssh/sshd_config to 30 and I think it is saved. But again when I want to log in I receive the same error that connection on port 22 is refused.

  • Try connecting to root@serverIP:30 – Noy Gabay Aug 14 '14 at 13:49
  • Your question is not very clear. You need to show exactly what you tried, what errors you received (quoted literally, on its own line), and what configuration you are using – Jo So Aug 14 '14 at 13:49
  • Some shots in a dark: Maybe you are confusing IP and Port. these are not the same. Try restarting you ssh server: /etc/init.d/ssh restart or similar. – Jo So Aug 14 '14 at 13:50
2

Specify the ssh port:

ssh -p 30 root@serverIP

Also don't move the port just because you think it's more secure. Rather disallow root login, use keyfiles instead of password an maybe run something like fail2ban if the logentries start to annoy you..

| improve this answer | |
  • Thank you. It is soved But after entering password I received Permission denied, please try again. Do you know what is the problem and how can I solve it? – androidGirl Aug 14 '14 at 13:54
  • Did you change anything else in sshd_config? – Trudbert Aug 14 '14 at 13:59
  • No nothing else – androidGirl Aug 14 '14 at 14:14
  • do you have some other account you can try to login to? – Trudbert Aug 14 '14 at 14:15
  • or other (physical) access to the server? – Trudbert Aug 14 '14 at 14:23
2

If the SSH server is listening on port 30 on the remote host, you need to specify port 30 to your client:

ssh -p 30 root@serverIP

You can avoid typing it all the time by adding this to your .ssh/config file

host MyServer
    user root
    port 30
    hostname serverIP

Then you can simply type

ssh MyServer
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy