rsync: SSH를 통한 권한 거부(공개 키)

rsync: SSH를 통한 권한 거부(공개 키)

. id_rsa.pub​저는 클라이언트측과 서버측에서 데비안을 사용하고 있습니다.

보안 강화를 위해 루트 인증 및 비밀번호 사용을 비활성화하는 튜토리얼을 따랐습니다( /etc/ssh/sshd/sshd_config서버에서 파일을 구성하여).

지금까지는 을 사용하여 rsync컴퓨터에서 서버로 파일을 쉽게 동기화할 수 있었습니다.

며칠 전, 크론 작업을 사용했습니다.작업을 수행하려면 서버 측에서 루트 비밀번호를 재설정해야 했습니다.

그 이후로 rsyncSSH; 다음 메시지가 나타납니다.

[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>

원인은 확실하지 않지만 root키가 내 classic데스크톱 사용자만을 위한 것이기 때문에 내 데스크톱 컴퓨터 사용자가 SSH에서 내 서버에 액세스하는 것이 허용되지 않은 것 같습니다(즉, sudo가 없음).

누구든지 확인해 주실 수 있나요? 감사합니다.

관련 정보