Tell me more ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I am not able to ssh into my pi. RPI is connected directly to my host PC.

I have set IP address of my host :----

sudo ifconfig eth0 192.168.0.204 netmask 255.255.255.0 up
sudo route add default gw 192.168.0.200

Pi have default IP in network interfaces file as :----

auto lo eth0
iface lo inet loopback
iface eth0 inet static
    address 192.168.0.202
    netmask 255.255.255.0
    gateway 192.168.0.200

if config comand on my PC :-----

ignite@ignite-desktop:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 6c:f0:49:f3:a6:1b  
          inet addr:192.168.0.204  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::6ef0:49ff:fef3:a61b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:681 errors:0 dropped:0 overruns:0 frame:0
          TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:43752 (43.7 KB)  TX bytes:33407 (33.4 KB)
          Interrupt:26 Base address:0x4000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1012 (1.0 KB)  TX bytes:1012 (1.0 KB)

Ping is working for same host :----

ignite@ignite-desktop:~$ ping 192.168.0.204
PING 192.168.0.204 (192.168.0.204) 56(84) bytes of data.
64 bytes from 192.168.0.204: icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from 192.168.0.204: icmp_seq=2 ttl=64 time=0.018 ms
64 bytes from 192.168.0.204: icmp_seq=3 ttl=64 time=0.017 ms
64 bytes from 192.168.0.204: icmp_seq=4 ttl=64 time=0.014 ms

Ping is working for pi from my host PC :----

ignite@ignite-desktop:~$ ping 192.168.0.202
PING 192.168.0.202 (192.168.0.202) 56(84) bytes of data.
64 bytes from 192.168.0.202: icmp_seq=1 ttl=64 time=0.530 ms
64 bytes from 192.168.0.202: icmp_seq=2 ttl=64 time=0.508 ms
64 bytes from 192.168.0.202: icmp_seq=3 ttl=64 time=0.464 ms
64 bytes from 192.168.0.202: icmp_seq=4 ttl=64 time=0.445 ms
64 bytes from 192.168.0.202: icmp_seq=5 ttl=64 time=0.434 ms

SSH is not working

ignite@ignite-desktop:~$ ssh pi@raspberrypi
ssh: Could not resolve hostname raspberrypi: Name or service not known

ignite@ignite-desktop:~$ ssh [email protected]
Read from socket failed: Connection reset by peer

ignite@ignite-desktop:~$ ssh 192.168.0.202 -l pi
Read from socket failed: Connection reset by peer

Please suggest how to resolve it ?

edit :---
ssh -vvv [email protected] ---> output is

ignite@ignite-desktop:~$ ssh -vvv [email protected]
OpenSSH_5.1p1 Debian-6ubuntu2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.202 [192.168.0.202] port 22.
debug1: Connection established.
debug1: identity file /home/ignite/.ssh/identity type -1
debug1: identity file /home/ignite/.ssh/id_rsa type -1
debug1: identity file /home/ignite/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-2
debug1: match: OpenSSH_6.0p1 Debian-2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-6ubuntu2
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Read from socket failed: Connection reset by peer
share|improve this question
1  
Have you checked that the ssh daemon is running? – codey Apr 19 at 14:45
actually i do not have an HDMI screen & was using my remote desktop computer to logon into pi using ssh. Now how can i check it out ? – Allan Apr 19 at 17:18
ps aux | grep sshd – codey Apr 22 at 0:38
If sshd is running, the output will show the sshd process(es). Besides the "grep sshd" that we just ran, of course. – codey Apr 22 at 0:46

3 Answers

Reason for issue and fix

Without special programs, you cannot ssh into the Pi using its host name. For LAN networks, ping the host. Once you have the IP, write it down. Then write into the terminal:

ssh pi@this_is_the_ip

and you should be able to log in.

If you want to access the Pi from outside of your home network, you must port forward your router. In fact, there is a stack exchange question on how to do this.

Assuming that you still want to use a nice name for your Pi, there is one option that will work both within your network and without it.

DNSDynamic

This software allows you to set up a domain name for your pi.

  1. Go to their website and set up a domain name and an account.

  2. Install ddclient on your Pi.

    sudo apt-get install ddclient 
    

    And then edit the config settings.

    sudo nano /etc/ddclient.conf
    

    Finally, change the file to the following:

# /etc/ddclient.conf

daemon=600

timeout=10

ssl=yes

protocol=dyndns2

use=web, web=myip.dnsdynamic.com #Enter your URL here

server=www.dnsdynamic.org

[email protected]  #userid for dnsdynamic.com

password='xxxx'      #password for the same put inside quotes

x.dnsdynamic.com  #the domain name you created

Assuming that you want this to auto start every time your computer wakes up, enter the following into the terminal.

sudo nano /etc/rc.local

Add the following command before exit 0(which is the last line)

sudo /usr/sbin/ddclient -daemon 600 -syslog

Lastly, you must still portforward.

Hopefully this is helpful. Ask questions in the comment section below.

share|improve this answer
Actually i compiled & installed latest openssl to my target RPi . Now ssh is not working for me Does ssh depends upon openssl ? – Allan Apr 19 at 17:20
SSL (secure sockets layer) is not needed to run SSH. It may actually be the issue in this setup. But, please try using the Pi's local IP instead of its hostname. – xxmbabanexx Apr 19 at 17:47
i have posted o/p for -----> ssh -vvv [email protected] ---> can you suggest what is the problem – Allan Apr 20 at 2:58
i regenerated keys on my host & target .. removed known host file from ~/.ssh ... it worked ... – Allan Apr 20 at 3:48
remove all file from :--- /etc/ssh ----> except shh_config ---> and changed ssh config as per this link ---> blog.harshadura.net/2012/01/… – Allan Apr 28 at 11:12
show 1 more comment

You can have a look at my answer for this questions.

How to get the Raspberry Pi's IP address for SSH

Another possibility I didn't mention there is to buy a domain (it's very cheap) and play with the DNS. I bought the domain aasgard.info for 0.99 cents and assigned name ygdrasill.aasgard.info to an internal address (192.168.1.141 in this case). Then you need to set the default domain as the domain name you bought and voila' :)

I must confess that after having spent all the time to set up the domain I realized that using /etc/hosts file or avahi was much much easier :)

share|improve this answer

Are you sure that you've started an SSH server on your Raspberry Pi? Just because you can ping it doesn't mean it's running an SSH server. Try sshd for a light SSH server.

share|improve this answer

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.