rsync는 -o StrictHostKeyChecking=no 옵션을 사용할 수 없습니다.

rsync는 -o StrictHostKeyChecking=no 옵션을 사용할 수 없습니다.

아래 rsync는 작동하며 원격 디렉토리를 localhost로 복사하는 데 도움이 됩니다.

/bin/rsync -rv myremoteuser@myremotehost:/tmp/Deployments/ /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/

추가하면 -o StrictHostKeyChecking=no다음 오류와 함께 실패합니다.

/bin/rsync -rv -o StrictHostKeyChecking=no myremoteuser@myremotehost:/tmp/Deployments /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/
Unexpected remote arg: myremoteuser@myremotehost:/tmp/Deployments
rsync error: syntax or usage error (code 1) at main.c(1348) [sender=3.1.2]

나는 그것이 작동하기를 원하며 다음과 같이 큰따옴표 안에 넣어도 작동하기를 원합니다.

"/bin/rsync -rv -o StrictHostKeyChecking=no myremoteuser@myremotehost:/tmp/Deployments /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/"
bash: /bin/rsync -rv -o StrictHostKeyChecking=no myremoteuser@myremotehost:/tmp/Deployments /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/: No such file or directory

자세한 내용은 다음과 같습니다.

$ /bin/rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
[mylocaluser@mylocalhost myremotehost]$ uname -a
Linux mylocalhost 3.10.0-1160.76.1.el7.x86_64 #1 SMP Tue Jul 26 14:15:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

답변1

-oRsync는 명령줄에서 ssh 옵션을 사용 하지 않습니다 . -ersync 옵션에 전달된 ssh 명령 문자열에 ssh 옵션을 넣어야 합니다 . 그것은 다음과 같습니다:

/bin/rsync -rv -e 'ssh -o StrictHostKeyChecking=no' myremoteuser@myremotehost:/tmp/Deployments /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/

-e언급한 대로 매개변수가 작은따옴표로 묶여 있으므로 위의 내용을 큰따옴표로 묶을 수 있어야 합니다 . 매뉴얼 페이지에는 명령줄 옵션 RSYNC_RSH대신 환경 변수를 사용하는 방법도 언급되어 있습니다.-e

관련 정보