12

So I used to be able to SSH to Raspbian but now I can't even though we are on the same network. Any idea why is that?

Monas-MacBook-Pro:~ mona$ ssh [email protected]
ssh: connect to host 192.168.1.105 port 22: Operation timed out

P.S.: I should be able to SSH to Raspbian shell using any network, right?

Here's the ping result as requested in the comments:

Monas-MacBook-Pro:~ mona$ ping 192.168.1.105
PING 192.168.1.105 (192.168.1.105): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
ping: sendto: No route to host
Request timeout for icmp_seq 4
ping: sendto: Host is down
Request timeout for icmp_seq 5
ping: sendto: Host is down
Request timeout for icmp_seq 6
ping: sendto: Host is down
Request timeout for icmp_seq 7
ping: sendto: Host is down
Request timeout for icmp_seq 8
ping: sendto: Host is down
Request timeout for icmp_seq 9
ping: sendto: Host is down
Request timeout for icmp_seq 10
ping: sendto: Host is down
Request timeout for icmp_seq 11

Right now both Pi and my laptop are on the WiFi.

2
  • can you ping 192.168.1.105? is the Pi on WiFi or ethernet?
    – user40410
    Commented Jan 24, 2016 at 20:32
  • 3
    None of your pings made it from the sending machine to the receiving machine. This means you have the wrong IP address for the Pi, or there's a physical issue (bad cable/connector somewhere) with your network. Double check the Pi's IP address using hostname -I .
    – goobering
    Commented Jan 24, 2016 at 20:53

6 Answers 6

5

You may want to try these instructions:

The local IP address of your Raspberry Pi is not fixed, unless you are using a wireless adapter to connect, which will keep its IP address. You must be on the same Wi-Fi network for this to work. If you want to use SSH for the RPI, you can use these steps:

This is for remote desktop connection:

Start up your Pi to the terminal prompt. Type the following command "sudo apt-get install xrdp" If promoted enter your password (the default is "raspberry") Type "Y" and press enter. This is now installing xrdp onto your Pi which is the software we are going to use for the remote desktop connection. Wait for it to complete. Restart your Pi. We are going to check that xrdp is going to start up automatically. When your Pi has booted to the command prompt look for [ ok ] Starting Remote Desktop Protocol server : xrdp sesman. This shows you that xrdp is installed and automatically starting up on start up of your Pi The last step is to make a note of the IP address of your Pi which should also be displayed on the start up screen. In my case below it is 192.168.1.9. This is the address of your Pi on your network and what we will use to connect to your Pi from the second machine.

Second Machine Setup

  1. Launch Remote Desktop Connection which can be found at Start->All Programs->Accessories->Remote Desktop Connection
  2. Type in the IP Address for your Pi which you noted above.

  3. Click Connect (you may get a security warning at this stage just click OK if you do. After all it is your Pi on your network so nothing to worry about security wise).

  4. Leave the Module on the default of sesman-Xvnc and enter your username and password for your Pi. (The default is pi and raspberry if you haven't changed them).

  5. Click OK and after a few moments you should be greeted my your Raspberry Pi's desktop!

  6. When you are finished simply log-out from the Pi's desktop.

I found these step from here and they worked for me

Here is another way to use SSH:

SSH into Raspberry Pi I generally log into my Raspberry Pi via SSH, or Secure Shell to give it its full name. This allows command line access, to your Raspberry Pi, from another computer. Although it is possible to SSH into the Raspberry Pi from anywhere in the world, and I do, this post only covers SSH access over the local network. I will cover remote connection in a future blog post.

Although this does not give access to a GUI (Graphical User Interface), having access to the command line generally allows me to do 95% of what I need to do. The other 5% I could probably do through SSH, but sometimes you can't beat the comfort of a GUI. :-)

First of all you need to know the IP address of the Raspberry Pi you are wanting to log into. If you are unsure how to find this, then read my blog post explaining how you can do this remotely using an excellent tool called nmap.

To SSH into your Raspberry Pi from a Linux or Apple Mac computer this is very easy. You can just type your username and IP address into the command line using the following format:

ssh username@IPaddress

Ensure you substitute username with the username you are wanting to log into the remote computer with. The IP address should take the format 192.168.1.66

You may get a message explaining that the authenticity of the host cannot be established, and if you are sure you want to continue connecting. You will only see this message the first time you SSH into your Raspberry Pi. Simply type yes.

You will then be asked for your password, enter the password for the username you are trying to connect with.

For windows this is a little more tricky to set up as it requires an additional piece of software called PuTTY. However once installed this is really simple to use.

First go to the PuTTY website, www.putty.org, download and install the software.

Once installed load PuTTY

Under Host Name (or IP address) type in the IP address you would like to connect to. Select the SSH radio button. In the box under Saved Sessions type in a name to identify this computer, such as Raspberry Pi, and then click Save. Clicking on Open should now start your SSH session.

Next time you want to SSH into your Raspberry Pi you just need to load PuTTY, click on the saved session to highlight it and then click Open. Once you have typed in your password, when asked, you have remote access to your Raspberry Pi.

I found these instructions from here The original link is here: https://raspberrypi.stackexchange.com/a/34870/32923

17

As of November 2016, SSH is disabled by default on raspbian.

The easiest way to get around this is to place a file called "SSH" on the SD card (notice no file extension). SSH will then be enabled.

Adding Notes for users with monitor access from this link:

Apparently, the SSH server is now disabled by default. If there is no server listening for connections, it will not accept them. You can enable the SSH server on the Raspberry Pi according to this tutorial:

Enter sudo raspi-config in the terminal, first select Interfacing options, then navigate to ssh, press Enter and select Enable or disable ssh server. To explain the command:

sudo raspi-config This runs the Raspberry Pi configuration tool raspi-config as root (sudo is short for "superuser do"). It will ask you for your password to authenticate. The rest is just moving around the raspi-config menu.

4
  • 2
    Thank you, I may have reflashed the image like 5 times before reading about the new security update: raspberrypi.org/blog/a-security-update-for-raspbian-pixel
    – JHK
    Commented Feb 2, 2017 at 20:45
  • 1
    It has certainly caused some frustration, thank you for the excellent link which clearly explains why the frustration is necessary though.
    – Unencoded
    Commented Feb 2, 2017 at 22:51
  • 1
    Creating the ssh file won't help if the OP can't ping their RPi. Commented May 3, 2017 at 12:42
  • 1
    Very true @DmitryGrigoryev, this answer isn't designed to answer this question, more to provide a solution to a common problem faced by those new to Raspbian. The reason it is an answer here is because this page is the first result when someone searches "Why can't i ssh into my raspberry pi?" using Google, thus saving considerable amounts of time for those with the issue. It may break convention, but does so with good intentions and has evidently proved somewhat successful given the upvotes. I opened up a discussion about editing it that you are very welcome to join.
    – Unencoded
    Commented May 3, 2017 at 12:50
1

@Human.

I don't believe that just because it's a wireless adapter that it will keep its IP. Any network where DHCP is providing IP addresses could change the IP if it wanted to. The only way I know to reserve an IP address on a DHCP managed network is to use a reservation, which is typically a function of the router and will reserve an IP address for the MAC address of the network adapter in that machine. However this could mean two reserved IPs for a machine with both a wired and wireless adapter.

If you have lost your PI on the network then running nmap is a pretty good place to start. Not sure about a Windows version but there will be something. http://www.cyberciti.biz/networking/nmap-command-examples-tutorials/

1

If you remember the hostname of the Raspbian (e.g. myhost), you may try the following:

ssh [email protected]

avahi-daemon running as service would publish the hostname/IP (zeroconf). In Apple world, it is called bonjour. myhost.local would be resolved to the actual IP.

1

My issue happened due to my router rebooting and company coming over whose devices just happened to pick up the same static IP assignments as my two PIs, a 4 and a 0 W. I went inyo the dhcpcd.conf and set the static IPs of each to something that the router will never assign like 192.168.1.200 and 201. I followed the dhcpcd.conf instructions from: https://thepihut.com/blogs/raspberry-pi-tutorials/how-to-give-your-raspberry-pi-a-static-ip-address-update

In brief, just edit /etc/dhcpcd.conf to add

interface eth0

static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

The 'static routers' and 'domain_name_servers' should be the IP address of your router. The IP address should be an address sharing the same first 3 octets of the IP address (e.g. 192.168.0). Change eth0 to wlan0 if it's for WiFi instead of the Ethernet port.

1
  • That is unlikely the solution to the question.
    – RalfFriedl
    Commented Oct 9, 2019 at 5:17
0

Have you some kind of WiFi extender in place? Did AP Isolation kick in?

This is what happened to me:

I had this experience as well. My Raspi was connect using a TP-Link Powerline WiFi extender.

  • I could not SSH from my Mac to my Raspi
  • I could not SSH from my Raspi to my Mac
  • I could not reach from my Raspi the webserver on my Mac
  • I could reach pages on the internet from both computers

I powercycled the WiFi extender and I could SSH again.

It seems for some obscure reason the WiFi extender switched on, after some time, AP Isolation which prohibits communication of all connected clients between oneanother.

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