リモート マシンに id_rsa.pub を追加した後、ssh パスワードが失敗しました

リモート マシンに id_rsa.pub を追加した後、ssh パスワードが失敗しました

私のリモート マシンには という 2 人のユーザーがいます。1 人は でroot、もう 1 人は です。そして、 userというAlexander新しいユーザーを作成します。fitroot

# adduser fit

そして、自宅のマシンの をscpauthorized_keysに追加します。id_rsa.pubfit@remote_machine

fit$ cat id_rsa.pub >> ~/.ssh/authorized_keys

しかし、その後もリモートマシンにログインするにはパスワードを入力する必要があります

home$ ssh fit@remote_machine
fit@remote_machine's password: 
Last login: Fri Apr 15 09:55:34 2016
[email protected]:[/home/fit]

しかし、本当に困惑したのは、自宅のマシンの を にscp、の を追加したことです。そして、パスワードなしでリモート マシンにログインできます。id_rsa.pubAlexander@remote_machineauthorized_keysAlexander@remote_machine

home$ ssh alexander@remote_machine # login without passwd
Last login: Fri Apr 15 09:58:19 2016 from 27.46.137.183
/etc/profile:fc:80: no such event: 1
Alexander@localhost: ~

ありがとう!

答え1

SSHパスワードレス接続が失敗したのは権限が原因でした。権限を変更してください

$ chmod 700 .ssh
$ chmod 600 authorized_keys

今では問題なく動作します。

関連情報