rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

SSH on Raspberry Pi Zero W

Wed Mar 29, 2017 8:39 am

I am trying to get SSH working on a new Pi Zero W but I get as far as 'authenticated' on entering the password but the terminal then locks. It doesn't matter if I use 'putty' under Windows or 'juice' under Android as the terminal.
I have downloaded both the Jessie and Jessie lite versions 02/03/2017 and configured both the same way, enabled SSH and configured the WiFi.
If I use either of these images on a Pi Zero 1.3 with a WiFi dongle then all is OK and SSH will connect.
If I use the same SD card in the Zero W then SSH locks up.

It looks as if there is some hardware specific code or config for the Zero W that isn't setup correctly in the distro. Any ideas?

User avatar
startrek.steve
Posts: 386
Joined: Thu Aug 30, 2012 7:19 pm

Re: SSH on Raspberry Pi Zero W

Wed Mar 29, 2017 2:07 pm

Try deleting /home/pi/.ssh/known_hosts

That should start with a clean sheet.
Steve
Pi 2 running LibreElec Krypton, Pi 2 running Wheezy Desktop, Pi 1 headless Wheezy, downloading Radio, Pi 1 running Picore headless Media Server, Pi Zero to be an Old Time Radio Project. Pi 3 testing. Pi Zero W downloading Radio shows headless.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 3:59 pm

There is no '/home/pi/.ssh/' directory, as far as I can see this does not get created on a Pi zero even on the v1.3 when SSH works. I have previously seen it created on the Pi V3.

Rog

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26673
Joined: Sat Jul 30, 2011 7:41 pm

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 4:06 pm

rog wrote:There is no '/home/pi/.ssh/' directory, as far as I can see this does not get created on a Pi zero even on the v1.3 when SSH works. I have previously seen it created on the Pi V3.

Rog
Odd; if you are using ssh and haven't changed the default location, that folder should be there.

OP, are you trying to log in to the Zero over the wireless link, or log in to another device from the Pi over the wireless?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 4:52 pm

I am using putty under Windows on a PC and using a wireless dongle on a Pi zero 1.3 or integral wireless on the 'W'.
Logging in with 'pi' 'raspberry' and I haven't changed any setup apart from enabling SSH and the camera, expanded the file system and configured Bluetooth and WiFi.
I might re-flash the image and just enable SSH and WiFi so I've the minimum changes.

Rog

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26673
Joined: Sat Jul 30, 2011 7:41 pm

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 4:54 pm

Are you using password authentication or key pairs?

Are you using the Pi as an AP or at it and the connecting PC going via a wireless router?

Can you ping the Pi?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 4:54 pm

jamesh wrote: Odd; if you are using ssh and haven't changed the default location, that folder should be there.

OP, are you trying to log in to the Zero over the wireless link, or log in to another device from the Pi over the wireless?
You're assuming Raspbian Jessie Full. Some distros don't create the ~/.ssh directory for you. Easy enough mkdir ~/.ssh; chmod 700 ~/.ssh job done.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 5:24 pm

It responds to ping, it is just a network station using a wireless router and using password authentication.

Creating the directory as Dougie suggests doen't help with connecting via SSH. I am using Jessie Full although the lite version (at least superficially) behaves the same. I am concentrating on the full version as it's easier for me to debug.

Rog

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 7:13 pm

You need to populate ~/.ssh with a private key file and a matching public key. You ship the public key to the remote system and that allows you to connect without a password.

Start with cd ~/.ssh;ssh-keygen
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

linux_author
Posts: 248
Joined: Sat Apr 02, 2016 7:04 pm
Location: Gulf of Mexico
Contact: Website

Re: SSH on Raspberry Pi Zero W

Thu Mar 30, 2017 7:22 pm

this issue doesn't have anything to do with the Pi Zero W - it's an authentication problem under ssh... the .known_hosts file on the originating terminal can be edited for a fix by deleting the offending key... dunno where this is located on an MSFT-based boxen, but you should be able to use a text editor to correct

other posters here have also given good solutions

hth,

willie
on the 'brute-force rm -fr' Gulf of Mexico

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Fri Mar 31, 2017 6:24 am

I have started again from scratch
1) take a fresh image of Full Jessie 02/03/2017 and flash onto a 16GB SD card
2) Insert card into a Zero 1.3, attach USB hub with Wifi dongle, keyboard and mouse.
3) Boot and using the GUI raspi-config enable SSH, set the Wifi Country.
4) Set the Wifi password for visible network.
5) Reboot
6) Connect via putty from Windows PC with the result that SSH works.
7) Remove SD card and insert into Pi Zero W, connect USB hub (still with Wifi Dongle) and boot.
8) Try and connect via SSH from putty which then locks up.
9) Try and connect via SSH fro Juice on Android this displays debug of "Authentication succeeded (password) but locks up with "Connecting".

This seems so easily reproducible and only a problem on the Pi Zero W. I am not complicating matters by trying to use keys rather than a default username and password. This is the simplest case I am trying and should just work, maybe using keys would work but I have already spent several hours doing a 5 minute task.
I am surprised if no one else is seeing this issue.

Rog

linux_author
Posts: 248
Joined: Sat Apr 02, 2016 7:04 pm
Location: Gulf of Mexico
Contact: Website

Re: SSH on Raspberry Pi Zero W

Fri Mar 31, 2017 7:20 pm

the issue you are experiencing also occurs for me under OS X (i am running 10.10.5)... if i start swapping sdhc cards between RPi3s, Zeros (w/a wifi adapter), and an RPi Zero W, OS X's ssh implementation will complain and not allow a connect to an RPi with a swapped card until i either delete or reconfigure the known_hosts file on my Mac...

(you don't mention if you edit or delete your SSH's known_hosts file)

willie
on the rainy Gulf of Mexico

thump52
Posts: 1
Joined: Sat Apr 01, 2017 1:22 am

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 1:26 am

I am having the same problem with my Raspberry Pi W. Trying to access over Putty and its says connection failed , I then hooked up my Raspberry Pi 3 and tried with putty and it works. It must be an issue with the Pi W, I also have a regular Pi Zero and work fine with putty. Has anyone figured this out??

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 4:59 am

Can you ping the IP address for your RPiZW? Have you got the right WiFi credentials?

Stick the SDCard in your RPI3B and get it connected by WiFi. Then run sudo apt-get update && sudo apt-get -y dist-upgrade; sudo systemctl enable ssh.service; sudo poweroff

When that's poweroff is complete, swap if back to your RPiZW and see if it works.

If it still doesn't run, put it back in your RPi3B and run sudo rpi-update; sudo poweroff and try again.

If it still doesn't run then you have to suspect that the RPiZW hardware has a fault or your power supply isn't functioning.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 5:52 am

I'll try Dougie's suggestions but in response to Willie: I only started swapping the SDHC card around when I initially found the problem with the Zero W. My procedure for swapping was only as a test to try and locate the issue.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 6:26 am

Tried Dougie's suggestions and it's still the same. The fact that the GUI is fully operational on the PI Zero W makes me think that the PSU is OK.
As the Zero W is in short supply I've only got the one to try.

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 6:32 am

Use the power supply from your RPi3B.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 7:52 am

It's not a power supply issue. I had already checked this before I made my first post.
Dougie, do you have a Zero W ?

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH on Raspberry Pi Zero W

Sat Apr 01, 2017 9:53 am

rog wrote:It's not a power supply issue. I had already checked this before I made my first post.
Dougie, do you have a Zero W ?
I've got a PiZ and a PiZC but don't have a PiZW.

I've got lots of Raspberries (3B*2, Zero/ZeroC with dongle and 2B with Redbear HAT) using the Broadcom/Cypress WiFi/BT chips.

Next move is sudo rpi-update to get to the 4.9.19+ kernel and latest bootcode.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Sun Apr 02, 2017 8:00 am

Hi, rpi-update doesn't make any difference.
Thanks, but I think I'll put this on hold until jamesh can verify the reproducibility.
Rog

davesteele
Posts: 60
Joined: Wed Nov 30, 2016 4:16 pm

Re: SSH on Raspberry Pi Zero W

Sun Apr 02, 2017 12:13 pm

Two things:

1 - You need to be using the latest Raspbian image for the Pi Zero W - the one dated "2017-03-02". Wifi didn't work properly for me using the previous image.

2 - I've got a modified Raspbian image that supports headless wifi configuration and ssh out-of-the-box.
https://davesteele.github.io/comitup/

tnecniv102
Posts: 3
Joined: Wed Aug 22, 2012 6:06 am

Re: SSH on Raspberry Pi Zero W

Thu Apr 06, 2017 12:09 pm

Same here can't connect to ssh via putty/ connectbot.
RpizeroW
Already done update upgrade. Using the latest jessie img

User avatar
elkberry
Posts: 167
Joined: Wed Dec 28, 2016 9:21 pm

Re: SSH on Raspberry Pi Zero W

Fri Apr 07, 2017 7:26 pm

That's odd. I have three Pi Zero Ws here, all three work beautifully with ssh over Wireless LAN. Raspbian Jessie. On Android, I'm using JuiceSSH (very nice ssh terminal client with toolbar for missing keys). On Windows, I'm using the ssh that comes with the git for Windows installation; should be the cygwin packaged one, me thinks.
From ZX81 to Raspberry Pi, but wait ... where's the 7805 gone?

User avatar
marine_hm
Posts: 93
Joined: Tue Mar 07, 2017 4:27 pm

Re: SSH on Raspberry Pi Zero W

Mon Apr 10, 2017 1:25 am

I am new to Raspberry Pi. I recently got my first Pi [Raspberry Pi Zero W] I have documented each step very closely in case I run into trouble I can reproduce what works. I have my Pi Zero W connected to my home wifi and SSH works rather well right out of the box.

Configure RaspberryPi for remote connection
Using PIXEL GUI:
1. Turn on WiFi
Left click WiFi icon on top right panel menu, select the SSID, type in Pre Shared Key{password}
2. Enable SSH [PUTTY]/command terminal
-- Click on Raspberry icon top left of screen
Preferences
-- Raspberry Pi Configuration
-- Host Name: I changed mine from “raspberry” to “Mosquitto_broker”
-- Don’t forget to change the pi Password
-- Click on interfaces tab; enable SSH, VNC
-- Localization tab for Location/Timezone/Keyboard/Country
-- OK

3. Open Putty on the remote computer; You can connect two ways;
a. Type in the Host name of your Raspberrypi or
b. Type the IP address displayed when you hover the mouse over the wifi icon on the top panel menu

rog
Posts: 14
Joined: Wed Mar 29, 2017 8:14 am
Location: Skipton

Re: SSH on Raspberry Pi Zero W

Mon Apr 10, 2017 8:25 am

Hi elkberry,
What is your network configuration? Just wireless with WPA security?
If I insert a wired ethernet USB dongle into the USB hub and attach a cable so that eth0 is working I can then connect via SSH using the wireless IP address. I initially thought the problem was to do with WPA security but now I'm thinking it is to do with a process stalling due to eth0 not being active. If the cable is removed from eth0 then the active wireless SSH connection breaks.

Rog

Return to “Raspberry Pi OS”