1

I would like to connect to my remote machine through SSH command line, but I don't know what are the appropriate terminal commands.

I always get an error "connection refused".

2
  • 1
    Excelent how-to on Ubuntu official help. Also type man ssh for manual pages.
    – hmayag
    Apr 30, 2014 at 6:45
  • What commands are you using that give the error?
    – terdon
    Apr 30, 2014 at 11:44

3 Answers 3

2

Command is

ssh -l username server_ip_address

or

ssh username@server_ip_address

If server refuse connection maybe is some different problem. Some firewall settings ...

2
  • I agree on the commands, but can you expand on the possible problems? Firewall, wrong pass, certificates, etc.
    – don.joey
    Apr 30, 2014 at 6:22
  • 1
    First try with nmap server_ip_address. Is server is up with ssh service ready to accept connection you will see PORT STATE SERVICE 22/tcp open ssh. If port is open server is ready. Do you have root privilege for server?
    – 2707974
    Apr 30, 2014 at 6:30
1

First of all you must be sure that the ssh server you want to connect is running. To do this, try typing:

telnet server_ip 22 

where 22 is the default port of the ssh protocol. If the port is different, you must change it. If the server replies to you, you can connect this way:

ssh <username>@server_ip -p 22 

is the user who has permission to access the server via ssh. The -p 22 argument can omit it if the port is the default, or if you use a different port you have to use it.

1

If I recall correctly, the ssh server sshd is not installed in Ubuntu by default.

sudo apt-get install openssh-server openssh-client

run on both machines will get ssh and sshd installed.

WARNING: sshd is not installed by default for good reason, it has the potential to open your system to any black-hat hacker or bot on the internet especially if you have weak passwords or firewalls. You should understand the security hole that you'll open before you open it.

1
  • you don't need openssh-server on the client machine, and openssh-client is not necessary on the server. Just make sure you have openssh-server installed and running on the server and openssh-client installed on the client.
    – Calimo
    Apr 30, 2014 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .