为什么 RSA SSH 认证仅在控制台登录后才有效?

为什么 RSA SSH 认证仅在控制台登录后才有效?

我在我的一台 Ubuntu 服务器上设置了 RSA 身份验证,但每次重启后,我都无法通过 ssh RSA 登录。为了使用 ssh 登录,我需要先通过控制台登录,然后 RSA 才能开始工作。为什么???

下面是我的 sshd 配置文件以及控制台登录之前和之后的 ssh -vv 命令的输出。

控制台登录之前:

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/smorhaim/.ssh/smorhaim (0x7ff8d8c242c0)
debug2: key: /Users/smorhaim/.ssh/id_rsaadmin (0x7ff8d8c24cf0)
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/smorhaim/.ssh/smorhaim
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/smorhaim/.ssh/id_rsaadmin
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

控制台登录后:

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/smorhaim/.ssh/smorhaim (0x7f91c14242c0)
debug2: key: /Users/smorhaim/.ssh/id_rsaadmin (0x7f91c1424ae0)
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/smorhaim/.ssh/smorhaim
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp b1:d5:90:43:be:43:52:a9:7f:05:c7:04:86:57:b3:ff
debug1: Authentication succeeded (publickey).
Authenticated to 10.10.30.151 ([10.10.30.151]:22).

sshd 配置:

Port 22
Protocol 2
ListenAddress 10.10.30.151

UsePrivilegeSeparation yes
SyslogFacility AUTHPRIV
PermitRootLogin no
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes

答案1

我刚刚遇到了同样的问题;原来我的主目录被加密了。有趣的是,我不记得选择了加密选项,而且似乎只是在最近升级后才开始发生这种情况(ubuntu 10.04.4 服务器)

答案2

告诉我你的/home文件系统/目录/挂载,它是加密的,还是从网络上的其他系统挂载的?我见过有人/home使用 pam_mount 或类似的东西设置加密的情况。然后他们没有正确地将挂载也应用于 SSH。

相关内容