ssh from 1 ubuntu box to another ubuntu box

1

I have 2 ubuntu boxes in a WiFi network. Below is the 'ifconfig' of my destination machine.

But in my source machine, I tried 'ssh 192.168.1.2' I get connection refused.

$ ifconfig
eth0  Link encap:Ethernet  HWaddr c8:0a:a9:4d:d6:6a  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
      Interrupt:35 

 wlan0 Link encap:Ethernet  HWaddr 00:23:14:32:e8:dc  
       inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
       inet6 addr: fe80::223:14ff:fe32:e8dc/64 Scope:Link
       UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
       RX packets:319828 errors:0 dropped:0 overruns:0 frame:0
       TX packets:618371 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000 
       RX bytes:30642011 (30.6 MB)  TX bytes:921522542 (921.5 MB)

How to set up so that I can ssh from 1 box to another?

michael

Posted 2010-05-03T15:22:50.123

Reputation: 4 127

Answers

1

There are a couple of things you need:

  • The IP address and credentials to login to the destination machine (obviously)
  • Make sure you can actually reach the other IP address. The ping command is your best friend here.
  • Remember that by default, root cannot remotely login via ssh. Use sudo
  • You need to make sure that openssh is installed. You can do this using Synaptics, search for openssh.
  • Look for a "meta package" for openssh. This will implement all needed components. Or just install openssh-server. You may have to accept other dependent packages to also be installed.
  • If you have a firewall installed, make sure that port 22 is open for inbound connection. This should be open by default.

Once all this is done, start the command-line prompt on the client machine, and enter the command:

$ ssh username@ipaddress Substitute "username" with the login id to use on the destination machine, and ipaddress with the full IP address of the server.

You can go without specifying the username. Then, the destination server will assume that you will login with the same username, only asking for the password.

In more advanced setup, you can look at setting SSH to listen on a different port. You can also use the certificate-based authentication. Look around on the internet for more documentation.

jfmessier

Posted 2010-05-03T15:22:50.123

Reputation: 2 530

1

Make sure on the destination machine that port 22 is open and that sshd is running.

Ignacio Vazquez-Abrams

Posted 2010-05-03T15:22:50.123

Reputation: 100 516

1in particular, sshd isn't installed by default; only the ssh client is. @michael will need to install the ssh or openssh-server packages from the Ubuntu repositories for the server. – quack quixote – 2010-05-03T16:36:37.480