You need to narrow down the problem step by step. First use a fresh flashed Raspbian Buster Light for troubleshooting. The light version reduces possible error sources. The unmodified version is guaranteed to work if you do not have broken hardware. Before starting the fresh installation place an empty file ssh
into the boot directory you have to mount on your computer/laptop. For details look on at 3. Enable SSH on a headless Raspberry Pi (add file to SD card on another machine).
On the booted RasPi verify if the ssh server is running:
rpi@raspberrypi:~ $ systemctl status ssh.service
Try to connect local to the ssh server; confirm with yes. The asked password is the login password of user pi if you logged in with this user. You should get the login message. Exit ssh with exit.
pi@raspberrypi:~ $ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:ROUpFKJ0Z64FobBlHfcIC1k78u01cxqG77d/CE5mH24.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
pi@localhost's password:
Linux raspberrypi 4.19.50-v7+ #896 SMP Thu Jun 20 16:11:44 BST 2019 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jul 2 10:33:04 2019
pi@raspberrypi:~ $ exit
logout
Connection to localhost closed.
pi@raspberrypi:~ $
You can also use the RasPis own ip address.
Now from a remote computer you should check with a network scanner if the ssh server on the RasPi is listening for connections on port 22. With a Linux operating system you can use nmap:
laptop ~$ nmap -p 22 192.168.10.92
Starting Nmap 7.40 ( https://nmap.org ) at 2019-07-02 11:50 CEST
Nmap scan report for 192.168.10.92
Host is up (0.0013s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 1 IP address (1 host up) scanned in 5.60 seconds
laptop ~$
As you can see my RasPi is listening with 22/tcp open ssh
.
If all this tests are successful it is very likely that the Raspberry Pi is not the problem. Use the debug option -vvv
of the ssh client on connection attempt, e.g. ssh -vvv pi@<ip-address>
. This will give you a bunch of additional information for the connection.
If only nmap fails then you should look at your network configuration (wrong router configuration?, broken wire?).
enable
command will just enable a service, not start it.start
will start,status
show whether it is running. The timeout indicates a firewall that blocks connections.