相关疑难解决方法(0)

SSH 公钥身份验证不起作用

我在 Ubuntu Server 12.04 (A) 上为 SSH 服务器设置公钥身份验证时遇到问题,以便从 Ubuntu Server 13.04 (B) 进行身份验证。

我现在在做什么(我正在尝试按照此处的说明进行操作):

  • 在 B 上:创建一个带有 的新密钥ssh-keygen -C "",不使用密码,写入/.ssh/id_rsa- 我没有收到任何错误
  • 在 B 上:运行ssh-copy-id -i /.ssh/id_rsa user@host-a- 还有一条成功消息
  • 在 B: ssh -i /.ssh/id_rsa user@host-a- 我仍然需要输入我的密码user@host-a

在A上,我检查了/.ssh/authorized_keys运行后是否修改了ssh-copy-id,是这种情况。此外,在两台设备上,我都将此添加到/etc/ssh/sshd_config

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)

有谁知道这里可能有什么问题?


这是我/var/log/auth.log在机器 A 上的尾巴:

Jun 13 22:17:56 laptop-camil sshd[12344]: Server listening on 0.0.0.0 port 22.
Jun 13 22:17:56 laptop-camil sshd[12344]: …
Run Code Online (Sandbox Code Playgroud)

server ssh security 12.04 sshd

10
推荐指数
1
解决办法
6万
查看次数

sshd_config 仍然允许密码认证

我已经调整了我的 sshd_config 文件,其中更改了以下值:

  • 密码认证 否
  • ChallengeResponseAuthentication 否
  • usePAM 否(现在设置为是)

此外,我已经通过执行重新启动sshd服务:sudo service ssh restart。我也重新启动了。

我仍然可以使用用户密码登录。知道我错过了什么吗?

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime …
Run Code Online (Sandbox Code Playgroud)

ssh password sshd

7
推荐指数
1
解决办法
1万
查看次数

已添加 SSH 公钥但仍提示输入密码

我在尝试设置以便使用笔记本电脑连接到 HTPC 时遇到错误,我已按照ubuntu 帮助中的指南 进行操作

这是我在远程主机上的 ~/.ssh/ 权限

-rw------- 1 htpc htpc  398 Feb 29 15:16 authorized_keys
-rw------- 1 htpc htpc 1675 Feb 29 15:15 id_rsa
-rw-r--r-- 1 htpc htpc  391 Feb 29 15:15 id_rsa.pub
Run Code Online (Sandbox Code Playgroud)

这是我在远程主机上的 /etc/ssh/sshd_config 文件

# Authentication: 
LoginGraceTime 120 
PermitRootLogin without-password 
StrictModes yes
RSAAuthentication yes 
PubkeyAuthentication yes 
AuthorizedKeysFile      %h/.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)

当我尝试通过 SSH 从本地计算机进入时,即使我的公共 ssh 密钥位于远程主机上的authorized_keys 内,它仍然要求我输入密码。

从本地计算机连接到 htpc 时的调试日志

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/mikeyr/.ssh/id_rsa
debug1: Authentications …
Run Code Online (Sandbox Code Playgroud)

ssh openssh

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

ssh ×3

sshd ×2

12.04 ×1

openssh ×1

password ×1

security ×1

server ×1