
遠端伺服器是類似 FreeBSD 的系統,未安裝 rsync:
$ ssh [email protected] which rsync scp
Password:
rsync not found
/usr/local/bin/scp
$ rsync -a /ring/0/share/Archives_AudioVisuel/TEST [email protected]:/ifs/par-nas01/data/MPP/ADN_Archives/Audiovisuels/
Password:
zsh:1: command not found: rsync
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]
$
我嘗試添加-e ssh
,但得到相同的錯誤,說rsync
is not found
。
如果我嘗試添加--rsync-path=/usr/local/bin/scp
,但隨後會出現scp: illegal option -- -
錯誤。
如何rsync
對只有該工具的伺服器進行操作scp
?
答案1
如果您無法在遠端 FreeBSD 電腦上安裝軟體,但可以在本機 Linux 電腦上安裝軟體,您可以使用sshfs
作為解決方法。
mkdir my_mountpoint
# The pathname (here just a slash) indicates the root of the mounted FS.
sshfs admin@remote_machine:/ $_
命令sshfs
啟動/usr/libexec/sftp-server
命令在遙控器上FreeBSD 機器,一台預先安裝的二進制。現在您可以使用掛載點,就好像它位於全域路徑名稱命名空間中一樣。請記住,${_}
shell 變數擴展為前一個命令的最後一個參數。
rsync -a /ring/0/share/Archives_AudioVisuel/TEST \
${_}/ifs/par-nas01/data/MPP/ADN_Archives/Audiovisuels/
完成後,使用該fusermount
實用程式卸載 FUSE(用戶空間中的檔案系統)掛載。
fusermount -u my_mountpoint
這個方法恐怕不行滿的不過,使用 rsync 的高效 Δ 複製演算法。如果您要同步影片檔案,我想這應該不是太重要。