.png)
などのキー ファイルを使用して SSH で接続するサーバーがありますid_rsa.pub
。クライアント側とサーバー側で Debian を使用しています。
セキュリティを強化するために、ルート認証とパスワードの使用を無効にするチュートリアルに従いました(/etc/ssh/sshd/sshd_config
サーバー上のファイルを構成することにより)。
これまでは、rsync
コンピューターからサーバーにファイルを簡単に同期できました。
数日前、 cronジョブを使用しました仕事のために、サーバー側でルートパスワードをリセットする必要がありました。
rsync
それ以来、を使用できなくなりSSH
、次のメッセージが表示されます。
[email protected]: Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far)[sender]
rsync error: unexplained error (code 255) at io.c(235)[sender=3.1.3]
似たようなトピックがいくつかありますが、私のケースは少し違うと思います。問題はサーバー上でパスワードをリセットしたことによるものだと思います。Ask Ubuntu サイトでも質問しましたが、権限の問題に関してはここの人たちの方が詳しいのではないかと思います。
問題を解決する方法が全く分かりません (ターミナル コマンドで少しは管理できますが、コンピューターの専門家ではありません)。助けていただけませんか?
参考までに、/etc/ssh/sshd_config
パスワードを使用しないように調整するチュートリアルをご覧ください:
#Uncomment or add the following line.
#This allows the server to give its DSA footprint in case of an ssh connection.
HostKey /etc/ssh/ssh/ssh_host_dsa_key
#Then set the next parameter to 20s (for example).
#This is the time during which a connection without being logged in will be opened.
#If we had kept the good old password technique, leave 2 or 3 minutes to type it, it's not too much.
#But since we're using the key now, we'll be logged in immediately. #So we can really reduce the thing and put it down to 20 seconds for example.
LoginGraceTime 20s
#this is the maximum number of attempts before being thrown by the server....
#Since with the key, no possible error, you can put it to 1 possible test.
MaxAuthTries 1
#Then, we will tell the SSH server where the keys are and tell it that we will use them as an authentication method
PubkeyAuthentication yes
AuthorizedKeysFile.ssh/authorized_keys
#And of course, we'll disable all other authentication methods
RSAAuthentication no.
UsePAM no
KerberosAuthentication no
GSSAPIA Authentication no.
PasswordAuthentication no
#Then, we will tell that we only allow users of the sshusers group (for more security)
AllowGroups sshusers
#The MaxStartups setting indicates the number of un-authenticated ssh connections you can launch at the same time.
#2 is more than enough, knowing that with the keys, it's instantaneous.
MaxStartups 2
答え1
解決策を見つけました... 私のコマンドは次のとおりです:
sudo rsync -avz -e "ssh -p <port>" <source> <destination>
しかし、私はそれを単純に(なしで)行う必要がありましたsudo
:
rsync -avz -e "ssh -p <port>" <source> <destination>
原因はよく分かりませんが、キーがデスクトップ ユーザー専用であったため (つまり sudo なし)、root
デスクトップ コンピューターのユーザーは SSH でサーバーにアクセスできなかったのだと思います。classic
どなたか確認していただけますか? ありがとうございます。