簡體   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