0

2 つの Linux ボックス間でパスワードなしの接続 (キーを使用) を作成しようとしています。以前に 20 回または 30 回実行したことがありますが、Centos 7 の新規インストールでこれと戦って試したのはこれが初めてです。ログインすると、まだパスワードを要求されます。

root@client:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
(client-key) root@client
The key's randomart image is:
+--[ RSA 2048]----+
|              E. |
|            . .  |
|             o   |
|            .  +.|
|      o S   ..o =|
|     o . . . ooo.|
|      . .  ..=+ .|
|       .   .=. . |
|        ..oo.oo  |
+-----------------+
root@client:~# ssh-copy-id -i .ssh/id_rsa.pub central@server
central@server's password:
Now try logging into the machine, with "ssh 'central@server'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

root@client:~# ssh central@server
central@server's password: (password entered at this point to make sure I had it correct)
Last login: Mon Jul 21 14:06:43 2014
[central@server ~]$

私は、.ssh フォルダーと authorized_keys ファイルのアクセス許可を確認することについて多くの言及を見つけ、あらゆる種類の異なる組み合わせでそれらを試しました。両方のサーバーの .ssh フォルダーを消去し、最初からやり直しました。SElinuxは両方のボックスで無効になっており、キーファイルにパスワードが設定されていませんでした。

何かご意見は?

4

2 に答える 2

2

ローカルマシンでこのコマンドを実行するだけで問題を解決しました(キーを生成した後):

$ ssh-add
于 2014-07-21T18:45:40.290 に答える