Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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".

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

3 Answers 3

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.

share|improve this answer
    
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 at 13:18

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.

share|improve this answer

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 ...

share|improve this answer
    
I agree on the commands, but can you expand on the possible problems? Firewall, wrong pass, certificates, etc. –  don.joey Apr 30 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 at 6:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.