I followed several steps to get an SSH over USB working. I followed the steps posted here. My Raspberry Pi Zero is connected with a standard micro USB cable to my desktop computer (Ubuntu 16.04). Desktop is running the avahi-daemon. I used the pi usb port labelled 'data'.

My pi is booted and running. ifconfig shows the Raspberry pi is connected (enp0s22f2u2i1 Link encap:Ethernet). It also has an inet6 address. SSH to this i6 adress returns a port 22: network is unreachable. Also ssh [email protected] as posted in the tutorials gives an error: ssh: Could not resolve hostname raspberrypi.local: Name or service not known.

I gave the rapsberry pi an IP adress using ifconfig enp0s22f2u2i1 Ubuntu gives me a notification that the device is connected, however I still can't SSH to the Pi (ssh [email protected]). But this time the error message is different: ssh: connect to host port 22: Connection refused.

What else can I try to get SSH over USB to my Pi Zero working? Perhaps I do need to adjust the setting for the bonjour service (avahi-daemon) running on my desktop?

  • What is are you using on the Pi? Nov 14, 2016 at 0:46
  • 1
    How are you running ifconfig on the Pi if the data cable is connected to another computer but you cannot connect to the Pi? If you are running ifconfig on the other computer, you didn't assign an IP to the Pi, you assigned it to the enp0... interface on that computer. That's not part of the Pi. That's a USB ethernet link on the PC/laptop/whatever. The pi is on the other end, but if you can't log into it, you can't configure the Pi side that way.
    – goldilocks
    Nov 14, 2016 at 4:28
  • I run ifconfig on the desktop side, since that side is running the bonjour service. Basically my question boils down to how to setup the avahi-daemon, since obviously the standard configuration is not working. What is the best way to test if the mDNS is enabled on the raspberry pi side?
    – Timtico
    Nov 14, 2016 at 9:19
  • @MohammadAli I would like to answer, but can you clarify your question?
    – Timtico
    Nov 14, 2016 at 9:24
  • @Timtico I ment to say "OS" as in operating system Nov 14, 2016 at 13:11

3 Answers 3


I am almost 100% sure that means your ssh is not enabled. Go to raspi-config and enable it from there.

  • 1
    the ssh was already enables. avahi-browseon my desktop connected to the pi shows the pi services (host name is p) Found service 'p (VNC Server)' of type '_rfb._tcp' in domain 'local' on 3.1. Found service 'p' of type '_udisks-ssh._tcp' in domain 'local' on 3.1. Found service 'p [f6:ea:85:b7:36:ba]' of type '_workstation._tcp' in domain 'local' on 3.1.
    – Timtico
    Mar 4, 2017 at 10:34

On your ubuntu machine, open the network interface settings and under ipv4 settings change the method drop-down to link-local. You should see the connection suddenly reconnect (if not, manually disable then re-enable the interface) and then the ssh will work as described.

What i havent been able to work out is how to share my internet connection from the ubuntu host to the pi


The first thing I would to is to run avahi-browse -art to see if the laptop discovered the RPi and what kind of address (IPv4 or IPv6) it has. I assume that it is IPv6, in that case you have to specify the right network interface when running the SSH client:

ssh -6 [email protected]%enp0s22f2u2i1 

This is the flip side of IPv6 protocol: every device on the network has an IP address (yay!) but exactly because of this, ssh has no idea where to send the data if you specify just the address. fe80::X:X:X addresses are valid for every IPv6 network interface, so if your laptop has more than one, SSH will need an extra hint. Technically you don't really need to specify the -6 argument, but debugging gets easier when you know exactly which protocol is concerned.

If that doesn't help, try disabling IPv6 for mDNS. Apparently, setting publish-aaaa-on-ipv4=no and use-ipv6=no in avahi-daemon.conf is enough, if you need IPv6 running for other purposes. Otherwise, you can disable IPv6 completely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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