3개의 원격 시스템을 통한 rsync SSH 에이전트 전달이 단일 명령에 대해 작동하지 않습니다.

3개의 원격 시스템을 통한 rsync SSH 에이전트 전달이 단일 명령에 대해 작동하지 않습니다.

나는 다음을 할 수 있습니다 :

$local> ssh -A remote1
$remote1> rsync -e "ssh remote2 ssh " remote3:/file .
$remote1>

remote1이는 의 키가 remote2내 그놈 키링에 있고 비밀번호가 필요하지 않기 때문에 작동합니다 remote3. 그러나 다음은 실패합니다.

$local> ssh -A remote1 "./scriptOnRemote1.sh"

scriptOnRemote1.sh정확히 동일한 rsync 명령을 실행합니다 . 다음 오류가 발생합니다.

Permission denied, please try again.
ssh_askpass: exec(/usr/lib64/ssh/ssh-askpass): No such file or directory
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.0]

두 사례의 자세한 출력 간의 차이점은 다음과 같이 시작됩니다.

pubkey_prepare: ssh_get_authentication_socket: No such file or directory

왜 이런 일이 발생합니까?

답변1

ssh-agentRemote1 호스트에 로그인하여 실행해 주세요 .

답변2

이는 실행 중인 스크립트가 키에 액세스할 수 없기 때문에 발생합니다. 이렇게 하면 다음 중 하나도 작동하지 않습니다.

ssh -A remote1 'rsync -e "ssh remote2 ssh " remote3:/file .'

관련 정보