新的 RaspberryPi 安全更新已经默认禁用了 SSH

以前,新刷好的 raspbian 是可以直接通过 SSH 连上的,现在则是:

1
2
$ ssh [email protected]
ssh: connect to host 192.168.1.143 port 22: Connection refused

官方博客找到了原因:

Anyone who has been following tech media over the last few months will have seen the stories about botnets running on Internet of Things devices. Hackers are using the default passwords on webcams and the like to create a network capable of sending enough requests to a website to cause it to grind to a halt.

大概就是 IoT 里默认的 SSH 密码已经成了黑客攻击的重灾区。

解决方案也很简单,在 SD 卡根目录新建一个名为 ssh 的文件(内容无所谓),之后 SD 卡的内容会被 mount 到 /boot/,启动的时候树莓派检测到这个文件,就会开启 SSH。