在配置SSH免密登錄時報錯:/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': 沒有那個文件或目錄


在配置SSH免密登錄時報錯:/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': 沒有那個文件或目錄

問題

1 [root@hadoop1 sbin]# ssh-copy-id hadoop1
2 
3 /usr/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': 沒有那個文件或目錄
4     (to install the contents of '/root/.pub' anyway, look at the -f option)

解決方法

 1 [root@hadoop1 sbin]# ssh-keygen -t dsa
 2 Generating public/private dsa key pair.
 3 Enter file in which to save the key (/root/.ssh/id_dsa):
 4 Enter passphrase (empty for no passphrase):
 5 Enter same passphrase again:
 6 Your identification has been saved in /root/.ssh/id_dsa.
 7 Your public key has been saved in /root/.ssh/id_dsa.pub.
 8 The key fingerprint is:
 9 SHA256:eNitxI+ZXMbqTHnZzQnql31bC+klM1ivGdhCQRssWhg root@hadoop1
10 The key's randomart image is:
11 +---[DSA 1024]----+
12 |       Eo .o     |
13 |       . o..o    |
14 |        o .o     |
15 |       * o  .    |
16 |      o S =...   |
17 |       + @.+=+o. |
18 |        X =+.@+o.|
19 |       + o  = @ +|
20 |        o .. + +.|
21 +----[SHA256]-----+

再次 ssh-copy-id hadoop1

 1 [root@hadoop1 sbin]# ssh-copy-id hadoop1
 2 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub"
 3 /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
 4 /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
 5 root@hadoop1's password:
 6 
 7 Number of key(s) added: 1
 8 
 9 Now try logging into the machine, with:   "ssh 'hadoop1'"
10 and check to make sure that only the key(s) you wanted were added.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM