树莓派 SSH 访问被拒绝

发布于 2025-01-20 11:10:42 字数 272 浏览 2 评论 0 原文

我正在尝试使用 Raspberry )登录Raspberry Pi时,它会说访问被拒绝

我有创建的 wpa_supplicant.conf 文件和ssh文件。这是其第一个启动。我正在使用最新版本的Raspbian Lite OS。

I am trying to log into my Raspberry Pi using PuTTY from Windows. However, whenever I try to log into my Raspberry Pi using the default username and password (pi* and raspberry) it says Access Denied.

I have the wpa_supplicant.conf file and ssh file created. This is its first bootup. I am using the latest version of the Raspbian Lite OS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

ヅ她的身影、若隐若现 2025-01-27 11:10:42

最近,Raspbian 的默认用户设置发生了重大变化,导致大多数现有的在线教程无效。

本质上,默认的 pi 用户不再存在,因此您必须使用官方的 Imager 工具或在 microSD 卡的 boot 分区中创建一个 userconf 文件,该文件应包含一行文本: 用户名:哈希密码,将 username 替换为您想要的用户名(例如,pi),并将 hashed-password 替换为您想要的密码的哈希值。

根据官方指南,最简单的方法是在终端(Linux 或 macOS)中运行以下命令:

echo 'password' | openssl passwd -6 -stdin

同样,您应该将 password 替换为您想要的密码。

进一步阅读:Raspberry Pi OS Bullseye 更新< /a> (2022-04-07)

Recently, the default user setup of Raspbian was significantly changed, rendering most existing online tutorials invalid.

In essence, the default pi user no longer exists, so you have to create it and set its password using either the official Imager tool or by creating a userconf file in the boot partition of your microSD card, which should contain a single line of text: username:hashed-password, replacing username with the name of the user you want (e.g., pi) and hashed-password with the hash of the password you want.

According to the official guide, the easiest way to do this is by running the following in a terminal (Linux or macOS):

echo 'password' | openssl passwd -6 -stdin

Again, you should replace password with the password you want here.

Further reading: An update to Raspberry Pi OS Bullseye (2022-04-07)

未蓝澄海的烟 2025-01-27 11:10:42

默认用户名和密码对 Raspberry Pi 不再有效。

如果您尝试无头登录(没有显示器和键盘),您可以从 Raspberry Pi 进行登录成像仪本身。
在 Raspberry Pi Imager 中选择操作系统时,您会看到一个设置图标,您可以在其中

  • 创建用户
  • 设置 Wi-Fi
  • 启用 SSH

配置后,您可以继续刷新您的设备存储卡
第一次启动时,您就可以开始使用了。

The default username and password are no longer valid for Raspberry Pi.

If you are trying to log in headlessly (without a monitor and keyboard), you can do it from Raspberry Pi Imager itself.
On selecting the OS in Raspberry Pi Imager, you get an icon of settings in which you can

  • create a user
  • setup Wi-Fi
  • enable SSH

After configuring, you can continue flashing your memory card.
And on first boot you will be good to go.

空‖城人不在 2025-01-27 11:10:42

我已经解决了这个问题。您可以使用 Raspberry Pi Imager 轻松输入用户名和密码。

在 Raspberry Pi Imager 中使用“高级选项”示例的屏幕截图

I have solved this problem. You can easily input your username and password with Raspberry Pi Imager.

Screenshot of an example of using "Advanced Options" in Raspberry Pi Imager

稀香 2025-01-27 11:10:42

确保使用如下所示的用户名和 IP 地址 ssh 到您的树莓派。

ssh [email protected]

我错误地假设我的用户名是 pi 并且 IP 地址只能用主机名“raspberrypi”表示。

ssh pi@raspberrypi

这是错误的。希望这有帮助。

Make sure to ssh to your raspberry pi with its username and ip address like below.

ssh [email protected]

I had made the mistake of assuming my username was pi and the ip address can just be represented with hostname "raspberrypi".

ssh pi@raspberrypi

Which is wrong. Hope this help.

面如桃花 2025-01-27 11:10:42

一个简单的解决方案只需要一个步骤。

使用您的PC/Mac创建一个名为 userconf.txt 的文件,然后将其放入 sd card root文件夹中 root文件夹,然后写出 Raspberry Pi OS < /代码>图像系统。


pi:/4g6TptuTP5B6

演示

测试

# check ✅
$ cat /boot/userconf.txt
pi:/4g6TptuTP5B6

”在此处输入图像说明“

refs

https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-a-user

A simpler solution only needs one step.

Create a file named userconf.txt with your PC / Mac, and drop it into your SD card root folder after you write the Raspberry Pi OS image system.

pi:/4g6TptuTP5B6

demo

enter image description here

test

# check ✅
$ cat /boot/userconf.txt
pi:/4g6TptuTP5B6

enter image description here

refs

https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-a-user

☆獨立☆ 2025-01-27 11:10:42

将刷写镜像时创建的用户添加到 ssh 组。

 usermod -a -G ssh YourPiUsername

add the user you created when flashing the image to the ssh group.

 usermod -a -G ssh YourPiUsername
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文