透過 ssh 遠端複製檔案不起作用

透過 ssh 遠端複製檔案不起作用

我嘗試將一個資料夾從我的 Linux 機器遞歸複製到遠端機器,但它不起作用。我嘗試使用 scp 和 rsync,但在這兩種情況下都沒有複製文件,儘管我收到了確認訊息。這是我的日誌:

aleks@ThinkPad-T530:/opt/homeToDeal/werbung/column$ scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
Warning: the ECDSA host key for 'heimdi.at' differs from the key for the IP address '185.101.157.64'
Offending key for IP in /home/aleks/.ssh/known_hosts:2
Matching host key in /home/aleks/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password: 
ue_hor.png                                    100%  639KB 110.7KB/s   00:05    
striche_hor.png                               100%  730KB 110.8KB/s   00:06    
striche_vert.png                              100%  346KB 119.7KB/s   00:02    
ue_vert.png                                   100%  435KB 119.0KB/s   00:03  

但是當我登入遠端機器時,我得到:

administrator@14980:/opt/homeToDeal/werbung/row$ ls
administrator@14980:/opt/homeToDeal/werbung/row$ cd ..
administrator@14980:/opt/homeToDeal/werbung$ cd column
administrator@14980:/opt/homeToDeal/werbung/column$ ls
administrator@14980:/opt/homeToDeal/werbung/column$ 

當我嘗試使用 rsync 時,我得到:

aleks@ThinkPad-T530:/opt/homeToDeal$ rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
Warning: the ECDSA host key for 'heimdi.at' differs from the key for the IP address '185.101.157.64'
Offending key for IP in /home/aleks/.ssh/known_hosts:2
Matching host key in /home/aleks/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password: 
sending incremental file list
werbung/
werbung/column/
werbung/column/striche_vert.png
werbung/column/ue_vert.png
werbung/row/
werbung/row/striche_hor.png
werbung/row/ue_hor.png

但同樣,沒有複製任何文件。

答案1

正如 @DougSmythies 在他的評論中所說:

“我懷疑這些文件確實被複製了,你只需找到它們即可。查看 /opt/homeToDeal/werbung/werbung。”

是的,事實確實如此。因此,下次我遞歸複製資料夾時,我應該確保目標資料夾不包含路徑中的最後一個來源資料夾,即

代替

  scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung

我將有

  scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/

或分別代替

rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung

我將有

rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal

相關內容