![rsync는 -o StrictHostKeyChecking=no 옵션을 사용할 수 없습니다.](https://linux55.com/image/211279/rsync%EB%8A%94%20-o%20StrictHostKeyChecking%3Dno%20%EC%98%B5%EC%85%98%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%A0%20%EC%88%98%20%EC%97%86%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
아래 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
-o
Rsync는 명령줄에서 ssh 옵션을 사용 하지 않습니다 . -e
rsync 옵션에 전달된 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