繁体   English   中英

ssh 连接权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic、密码)

[英]ssh connect Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

我在机器 A 上有一对 epadmin 的密钥。我通过文件夹 .ssh 中的scp将它们复制到机器 B 上的 epadmin 主文件夹中

访问命令:ssh epadmin@10.2.11.13

[epadmin@3A1D .ssh]$ ls -la
total 24
drwxrwxr-x 2 epadmin epadmin 4096 May 12 14:41 .
drwx------ 6 epadmin epadmin 4096 May 12 14:40 ..
-rw-r--r-- 1 epadmin epadmin  438 May 12 14:41 config
-rw------- 1 epadmin epadmin 1671 May 12 14:41 id_rsa_auto_epmc
-rw-r--r-- 1 epadmin epadmin  407 May 12 14:41 id_rsa_auto_epmc.pub
-rw-r--r-- 1 epadmin epadmin 2818 May 12 14:41 known_hosts

这是一段 -vvv(Verbose) 日志

debug1: Next authentication method: publickey
debug1: Trying private key: /home/epadmin/.ssh/identity
debug3: no such identity: /home/epadmin/.ssh/identity
debug1: Trying private key: /home/epadmin/.ssh/id_rsa
debug3: no such identity: /home/epadmin/.ssh/id_rsa
debug1: Trying private key: /home/epadmin/.ssh/id_dsa
debug3: no such identity: /home/epadmin/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug3: packet_send2: adding 64 (len 52 padlen 12 extra_pad 64)

没有密码我无法登录

sshd_config 的一部分。 我试图取消对 RSAAut 的注释并将 no 粘贴到密码验证中。 没有变化

# Authentication:
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys
#AuthorizedKeysCommand none
#AuthorizedKeysCommandRunAs nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

您的问题应该是服务器故障。 这是一个基本的麻烦,或者我应该说两个:

  • 在服务器端:当您在 .ssh 目录中的 epadmin 上上传您的密钥时,您必须在 authorized_keys 中重命名您的 id_rsa_auto_epmc.pub 文件
  • 在客户端:您为私钥使用非默认密钥名称,因此您必须使用 -i 选项指定密钥的路径:ssh -i ~/id_rsa_auto_epmc

无需更改用于密钥认证的默认 sshd_config 文件。 对于您的问题,最好将您使用的 ssh 命令行。

在终端解决错误

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

ssh-keygen -f " ~/.ssh/known_hosts" -R xx.xx.xxx.xxx

xx - ip 主机

①你的目录.ssh应该是0700,.ssh目录和他儿子文档的作者和组是你的

②authorized_keys 应该是 0600 或 0644

③也许你复制公共authorkey内容到authorized_keys没有运行,现在你可以尝试将authorkey复制到远程主机你的目录.ssh并重命名authorized_keys,是的,你可以试试! 可怜的英语我跑了

暂无
暂无

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

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