简体   繁体   English

树莓派 SSH 权限被拒绝

[英]Raspberry Pi SSH permission denied

I went through existing threads and was unable to find a solution for my issue.我浏览了现有的线程,无法找到解决我的问题的方法。

I am using Raspberry Pi 2 model B and am able to use it by connecting to Display via HDMI.我正在使用 Raspberry Pi 2 型号 B,并且可以通过 HDMI 连接到显示器来使用它。 I am now trying to SSH via my macbook air (OS Sierra) and am using Gigaware USB to ethernet adapter.我现在正在尝试通过我的 macbook air (OS Sierra) 进行 SSH,并且正在使用 Gigaware USB 到以太网适配器。 My steps are as follows:我的步骤如下:

  1. in terminal type: ssh -v pi@在终端类型中:ssh -v pi@
  2. when prompted to enter password, enter "raspberry" (my terminal asks me three times to enter a password and then the fourth time to enter password for pi@).当提示输入密码时,输入“raspberry”(我的终端要求我输入密码三次,然后第四次输入 pi@ 的密码)。

Thank you for your help谢谢您的帮助

I'm getting the following output:我得到以下输出:

Last login: Sun Jun 25 16:33:22 on ttys000 Annas-MacBook-Air:~ annazotova$ ssh -v pi@192.168.0.3 OpenSSH_7.3p1, LibreSSL 2.4.1 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug1: /etc/ssh/ssh_config line 102: Applying options for * debug1: Connecting to 192.168.0.3 [192.168.0.3] port 22. debug1: Connection established.上次登录时间:Sun Jun 25 16:33:22 on ttys000 Annas-MacBook-Air:~ annazotova$ ssh -v pi@192.168.0.3 OpenSSH_7.3p1, LibreSSL 2.4.1 debug1: Reading configuration data /etc/ssh/ssh_config debug1 :/etc/ssh/ssh_config 第 20 行:为 * debug1 应用选项:/etc/ssh/ssh_config 第 102 行:为 * debug1 应用选项:连接到 192.168.0.3 [192.168.0.3] 端口 22。 debug1:已建立连接。 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/annazotova/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version strin debug1:key_load_public:没有这样的文件或目录 debug1:身份文件 /Users/annazotova/.ssh/id_rsa 类型 -1 debug1:key_load_public:没有这样的文件或目录 debug1:身份文件 /Users/annazotova/.ssh/id_rsa-cert 类型-1 debug1:key_load_public:没有这样的文件或目录 debug1:身份文件 /Users/annazotova/.ssh/id_dsa 类型 -1 debug1:key_load_public:没有这样的文件或目录 debug1:身份文件 /Users/annazotova/.ssh/id_dsa-证书类型-1调试1:key_load_public:没有这样的文件或目录调试1:身份文件/Users/annazotova/.ssh/id_ecdsa类型-1调试1:key_load_public:没有这样的文件或目录调试1:身份文件/Users/annazotova/.ssh/ id_ecdsa-cert type -1 debug1:key_load_public:没有这样的文件或目录 debug1:身份文件/Users/annazotova/.ssh/id_ed25519 type -1 debug1:key_load_public:没有这样的文件或目录debug1:身份文件/Users/annazotova/。 ssh/id_ed25519-cert type -1 debug1:启用协议 2.0 的兼容模式 debug1:本地版本字符串g SSH-2.0-OpenSSH_7.3 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.3 debug1: match: OpenSSH_7.3 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 192.168.0.3:22 as 'pi' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:LPy5oyssyqW7GgMg0P3ygylRK1bSAxTbijXYWIcpnNc debug1: Host '192.168.0.3' is known and matches the ECDSA host key. g SSH-2.0-OpenSSH_7.3 debug1:远程协议版本 2.0,远程软件版本 OpenSSH_7.3 debug1:匹配:OpenSSH_7.3 pat OpenSSH* compat 0x04000000 debug1:Authenticating to 192.168.0.3:22 as 'pi' debug1:SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT 收到 debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: 压缩:无已知并与 ECDSA 主机密钥匹配。 debug1: Found key in /Users/annazotova/.ssh/known_hosts:10 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs= debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /Users/annazotova/.ssh/id_rsa debug1: Trying private key: /Users/annazotova/.ssh/id_dsa debug1: Trying private key: /Users/annazotova/.ssh/id_ecdsa debug1: Trying private key: /Users/annazotova/.ssh/id_ed25519 debug1: Next authentication method: keyboard-interactive Password: debug1: Authentications that can continue: publickey,password,keyboard-interactive Password: debug1: Authentications that can continue: publickey,password,keyboard-interactive Password: debug1: Authentications tha debug1:在 /Users/annazotova/.ssh/known_hosts 中找到密钥:10 debug1:在 134217728 块后重新生成密钥 debug1:SSH2_MSG_NEWKEYS 已发送 debug1:期待 SSH2_MSG_NEWKEYS debug1:在 134217728 块后重新加密 debug1:收到 SSH2_MSG_NEWKEYS debug1:收到 SSH2_MSG_EXT_EXT_EXT sig-algs=debug1:SSH2_MSG_SERVICE_ACCEPT 收到 debug1:可以继续的身份验证:publickey、password、keyboard-interactive debug1:下一个身份验证方法:publickey debug1:尝试私钥:/Users/annazotova/.ssh/id_rsa debug1:尝试私钥: /Users/annazotova/.ssh/id_dsa debug1:尝试私钥:/Users/annazotova/.ssh/id_ecdsa debug1:尝试私钥:/Users/annazotova/.ssh/id_ed25519 debug1:下一个身份验证方法:键盘交互密码: debug1:可以继续的身份验证:publickey、password、keyboard-interactive 密码:debug1:可以继续的身份验证:publickey、password、keyboard-interactive 密码:debug1:身份验证t can continue: publickey,password,keyboard-interactive debug1: Next authentication method: password pi@192.168.0.3's password: debug1: Authentications that can continue: publickey,password,keyboard-interactive Permission denied, please try again. t 可以继续:publickey,password,keyboard-interactive debug1:下一个认证方法:密码 pi@192.168.0.3 的密码:debug1:可以继续的认证:publickey,password,keyboard-interactive 权限被拒绝,请重试。 pi@192.168.0.3's password: pi@192.168.0.3 的密码:

You aren't providing an address to ssh into.您没有提供 ssh 进入的地址。 The command should be命令应该是

ssh pi@[ip address of your pi]

If you don't know the ip address and you're on the same network, you can use its host name.如果你不知道 IP 地址并且你在同一个网络上,你可以使用它的主机名。 By default it is raspberrypi.默认情况下它是树莓派。

ssh pi@raspberrypi.local

here's what resolved the problem for me;- ( Background information .. I'm using a windows 10 laptop with an RPI version 3 board, communicating across my wifi network via my Netgear router. Using the laptop and it's monitor - no key-board or monitor connected to the RPI 3 board. Tightvncserver was previous installed and working on the rPI board )这就是为我解决问题的方法;-(背景信息..我正在使用带有 RPI 版本 3 板的 Windows 10 笔记本电脑,通过我的 Netgear 路由器通过我的 wifi 网络进行通信。使用笔记本电脑和它的显示器 - 没有键盘或显示器连接到 RPI 3 板。以前安装了 Tightvncserver 并在 rPI 板上工作)

here is how I resolved the defect;-这是我解决缺陷的方法;-

Powered down the RPI board Powered down the laptop Powered down the router关闭 RPI 板 关闭笔记本电脑 关闭路由器

Waited about 2 minutes Powered up the router, power up the laptop and logged onto the network Powered up the RPI 3 board.等了大约 2 分钟 给路由器通电,给笔记本电脑通电并登录到网络 给 RPI 3 板通电。

used Putty on the laptop to connect to the RPI board - That now worked !使用笔记本电脑上的 Putty 连接到 RPI 板 - 现在可以了! used winscp to connect across to the RPI board - that now worked, including using the existing RPI user name and existing password.使用 winscp 连接到 RPI 板 - 现在可以使用,包括使用现有的 RPI 用户名和现有密码。

Was able to start up the tightvncserver using the command tightvncserver (as normal ) since putty and winscp were now working, and the problem was now limited to being unable to connect via VNC.由于 putty 和 winscp 现在正在工作,因此能够使用命令 tightvncserver (正常)启动tightvncserver,问题现在仅限于无法通过 VNC 连接。 The tightvncserver on the RPI board was rejecting the correct password. RPI 板上的tightvncserver 拒绝了正确的密码。 I suspected that the problem was something to do with the tightvnc server settings.我怀疑问题与tightvnc 服务器设置有关。 So ... I Used the vncpasswd to change the VNC server password, as explained at https://www.itfixed.com/2009/05/how-to-change-vnc-server-password-on-linux/ That worked !所以...我使用 vncpasswd 更改 VNC 服务器密码,如https://www.itfixed.com/2009/05/how-to-change-vnc-server-password-on-linux/中所述! Interfacing between my laptop and the RPI 3 board was restored as normal.我的笔记本电脑和 RPI 3 板之间的接口恢复正常。 While I do not know exactly what caused the defect to occur,虽然我不知道究竟是什么导致了缺陷的发生,

I Hope this information may help others我希望这些信息可以帮助其他人

New Raspberry Pi OS does not come with default username and password .新的 Raspberry Pi OS 没有默认用户名密码 It needs to be configured before flashing in Raspberry Pi Imager itself.它需要在Raspberry Pi Imager本身闪烁之前进行配置。

New installation will not be able to use default pi, raspberry as credentials.新安装将无法使用默认 pi、raspberry作为凭据。 For security reasons RPi will ask to make a new user on the first boot itself.出于安全原因,RPi 将要求在第一次启动时创建一个新用户。

If you want to do this headlessly.如果你想无头地这样做。 Use RPi Imager and on selecting OS to write you will see a settings icon.使用 RPi Imager 并在选择要写入的操作系统时,您将看到一个设置图标。 In Setting you can create a user add a wifi credentials and also enable ssh在设置中,您可以创建用户添加 wifi 凭据并启用 ssh

If this is not the problem, Try deleting known_hosts file in .ssh folder from system which you are trying to ssh.如果这不是问题,请尝试从您尝试 ssh 的系统中删除 .ssh 文件夹中的known_hosts文件。 Try again with correct IP address使用正确的 IP 地址重试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM