SSH权限被拒绝(公共密钥),但root ssh可以工作

用户名

我正在尝试为在DigitalOcean Ubuntu 12.04服务器上用Chef创建的用户帐户设置ssh访问权限。我在DigitalOcean中设置了选项,以便在创建Droplet时自动复制Mac的ssh密钥。

我可以毫无问题地以root用户身份登录,但其他用户无法通过身份验证。这似乎是一个常见问题,我检查了其他一些答案,并找到此命令以获取更多信息:

ssh -vvv -i id_rsa user@serverIP

使用该命令的root用户(成功)的日志为

调试

1: Offering RSA public key: /Users/evan/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp snip!
debug3: sign_and_send_pubkey: snip!
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).

失败的用户:

调试

1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/evan/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/evan/.ssh/id_dsa
debug3: no such identity: /Users/evan/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.

在我看来,这意味着公钥不正确。但是,如果我以root用户身份登录并转到

home/otheraccount/.ssh/authorized_keys

然后我可以看到我的ssh密钥在那里。我以为可能有错误,所以我做到了:

cp .ssh/authorized_keys ~/home/otheraccout/.ssh/authorized_keys

但这没有帮助。我不知道还能去哪里。

我的etc/ssh/sshd_config

# 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
"sshd_config" 88L, 2508C
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

# GS

SAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding no
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60

AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM no
Banner /etc/ssh_banner

编辑:

drwx------ 2 deploy deploy 4096 Apr 20 06:00 .ssh
-rw------- 1 deploy deploy 820 Apr 20 05:35 authorized_keys

编辑2:

如评论中所建议,/var/log/authlog包含:

Apr 21 04:59:30 localhost sshd[586]: User deploy not allowed because account is locked
Apr 21 04:59:30 localhost sshd[586]: input_userauth_request: invalid user deploy [preauth]

我试着做:

sudo usermod --expiredate -1 deploy

它返回:

no changes
克莱门特
  • SSH登录可能由于各种原因而失败(错误的目录/文件权限,错误的密钥等),并且连接的客户端只会得到Permission deniedNo more authentication methods to try或某些一般性错误。

  • 登录失败的确切原因将在ssh日志中/var/log/auth.log/var/log/secure取决于syslog配置中提供。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

SSH权限被拒绝(公共密钥),但root ssh可以工作

来自分类Dev

访问公共 ssh 密钥的权限被拒绝

来自分类Dev

Azure ACS SSH登录失败,并显示“权限被拒绝(公共密钥)”

来自分类Dev

恢复了.ssh / authorized_keys文件,但仍收到“拒绝权限(公共密钥)”消息

来自分类Dev

SSH连接被拒绝并注册了公共密钥

来自分类Dev

root @ localhost的ssh连接权限被拒绝

来自分类Dev

root @ localhost的ssh连接权限被拒绝

来自分类Dev

SSH密钥,CYGWIN,BitBucket,权限被拒绝(公钥)

来自分类Dev

无效的公共SSH密钥

来自分类Dev

TRUSTY:ssh connexion [[email protected]权限被拒绝]

来自分类Dev

Ansible remote_user:root,ssh:权限被拒绝(公钥)

来自分类Dev

ssh密钥和ssh的工作

来自分类Dev

SFTP超时,但SSH可以正常工作

来自分类Dev

SFTP超时,但SSH可以正常工作

来自分类Dev

如何拒绝root SSH登录并要求用户提供SSH密钥?

来自分类Dev

如何拒绝root SSH登录并要求用户提供SSH密钥?

来自分类Dev

SSH“拒绝密钥”仅在公共IP上有效,在本地有效

来自分类Dev

git clone ssh权限被拒绝

来自分类Dev

SSH权限被拒绝(公钥)

来自分类Dev

Bazaar上的SSH权限被拒绝

来自分类Dev

权限通过SSH访问被拒绝

来自分类Dev

-bash:cd:.ssh /:权限被拒绝

来自分类Dev

SSH权限被拒绝(公钥)

来自分类Dev

ssh权限被拒绝(公钥)

来自分类Dev

权限通过SSH访问被拒绝

来自分类Dev

SSH / OpenMPI:权限被mpirun拒绝,但被ssh允许

来自分类Dev

无法克隆,可以SSH。“权限被拒绝(公钥)。”

来自分类Dev

Bitbucket权限被拒绝(公钥)。但是可以用ssh

来自分类Dev

生成SSH密钥后立即出现权限被拒绝(公钥)错误

Related 相关文章

热门标签

归档