我刚刚在 Amazon EC2 上部署了一个新的 Fedora 17 服务器。我能够使用生成的密钥对以 ec2-user 身份登录,但在正常情况下我无法以我创建的用户身份登录。这只是一个普通的 ssh:
ssh 用户@ip 地址
对于这里发生的事情有什么想法吗?
编辑:这是我的 sshd_config 文件中的片段
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no
PasswordAuthentication no
再次编辑:这是 ssh -v 的输出。
OpenSSH_5.8p2, OpenSSL 1.0.0i-fips 19 Apr 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 107.23.2.165 [107.23.2.165] port 22.
debug1: Connection established.
debug1: identity file /home/psion/.ssh/id_rsa type 1
debug1: identity file /home/psion/.ssh/id_rsa-cert type -1
debug1: identity file /home/psion/.ssh/id_dsa type 2
debug1: identity file /home/psion/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 19:cb:84:21:a9:0e:83:96:2f:6a:fa:7d:ce:39:0f:31
debug1: Host '107.23.2.165' is known and matches the RSA host key.
debug1: Found key in /home/psion/.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' not found
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' not found
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Next authentication method: publickey
debug1: Offering DSA public key: /home/psion/.ssh/id_dsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Offering RSA public key: /home/psion/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
答案1
交互式身份验证已禁用。您的客户端正在使用默认密钥对,我假设您正在将其用于 ec2-user。
根据您提供的信息,似乎您尚未将公钥复制到新用户的$HOME/.ssh/authorized_keys
。
为新用户创建一个新的密钥对并将其添加到本地~/.ssh/config
,或者将已经生成的公钥复制到新用户的$HOME/.ssh/authorized_keys
。
答案2
如果您尝试使用密码验证,则需要在 /etc/ssh/sshd_config 中启用它;
PasswordAuthentication yes
因为它默认是被禁用的;
prompt> grep PasswordAuthentication /etc/ssh/sshd_config
# PasswordAuthentication yes