我意识到这个问题已经以一些不同的方式被问过,但是我遇到的任何方式似乎都没有解决这个问题,所以这里是:
我正在尝试通过笔记本电脑上的 ssh 连接到我的 raspberry pi 3 raspbian 设置,但尽管我的 IP 地址正确,但我不断收到错误消息:
ssh: connect to host xxx.xxx.xx.x port 22: connection refused.
这很不寻常,因为当我尝试 ping 该地址时,它工作正常。有什么我可以尝试找出问题所在吗?
另外请记住,我对 linux 中的 bash 相对缺乏经验,因此将不胜感激包含任何特定命令并描述它们的作用。
最佳答案
显然,Raspbian 上的 SSH 服务器现在默认禁用。如果没有服务器监听连接,它将不接受它们。可以根据这个raspberrypi.org tutorial手动开启SSH服务器:
As of the November 2016 release, Raspbian has the SSH server disabled by default.
现在有多种方法可以启用它。 选择一个:
从桌面
- Launch
Raspberry Pi Configuration
from thePreferences
menu- Navigate to the
Interfaces
tab- Select
Enabled
next toSSH
- Click
OK
从终端使用 raspi-config
- Enter
sudo raspi-config
in a terminal window- Select
Interfacing Options
- Navigate to and select
SSH
- Choose
Yes
- Select
Ok
- Choose
Finish
用systemctl
启动SSH服务
sudo systemctl enable ssh sudo systemctl start ssh
在 headless 树莓派上
For headless setup, SSH can be enabled by placing a file named
ssh
, without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for thessh
file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.
关于linux - ssh 连接在 Raspberry Pi 上被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41318597/