2017-03-13 7 views
0

は私がリモートサーバにコピー公開鍵でパスワードなしでSSHログインを有効にする方法を知っている:パスワードと公開鍵なしでsshログインを行うには?

cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'

それは、パスワードと公開鍵なしでリモートサーバにログインすることは可能ですか?実際に

は今、私は2台のサーバー、AB

を持ってAで唯一.ssh/id_rsaがあり、そこBには.ssh/authorized_keysはありませんが、私はパスワードなしAからBにログインすることができます。

これを設定した人は辞めるので、彼はどのようにしたのか分かりません。

+1

あなたは、認証の詳細なプロセスを示すために、 'のssh -V'を試すことができます。 –

+0

'debug1:プライベートキーを試しています:/***/.ssh/id_rsa debug1:PEM秘密キーが読み込まれました:type RSA debug1:認証に成功しました(公開鍵)。 – Sato

+0

サーバーが公開キー認証を正常に行っているようです。タイトルに合わせて変更してください。 –

答えて

1

お使いのサーバーは、おそらく異なるキー検索パスで構成されています。

/etc/ssh/sshd_configで行を検索します。

AuthorizedKeysFile .ssh/authorized_keys 

これが変更された場合、サーバは、キーごとに異なるファイル(複数可)を検索します。

EDIT:もう少し公開鍵で認証される方法があります。

Authorizedで始まる多くの設定オプションが有効です。

マニュアルから:

AuthorizedKeysCommand 
     Specifies a program to be used to look up the user's public keys. 
     The program must be owned by root, not writable by group or oth‐ 
     ers and specified by an absolute path. Arguments to 
     AuthorizedKeysCommand accept the tokens described in the TOKENS 
     section. If no arguments are specified then the username of the 
     target user is used. 

     The program should produce on standard output zero or more lines 
     of authorized_keys output (see AUTHORIZED_KEYS in sshd(8)). If a 
     key supplied by AuthorizedKeysCommand does not successfully 
     authenticate and authorize the user then public key authentica‐ 
     tion continues using the usual AuthorizedKeysFile files. By 
     default, no AuthorizedKeysCommand is run. 
+0

私はこれだけ見つけました: 'HostDsaKey/etc/ssh/dsa_keys' – Sato

+0

このオプションが設定されていない場合、' .ssh/authorized_keys2'も受け入れられます。それは存在しますか? –

+0

いいえ、 '/ etc/ssh/sshd_config'ファイルや' .ssh/authorized_keys2'ファイルには 'AuthorizedKeysFile **'エントリはありません – Sato

関連する問題