SCP的兩個問題解決

參考文章:

https://www.cnblogs.com/jockechen/articles/10407093.html

https://www.cnblogs.com/huanghongbo/p/6254400.html

https://blog.csdn.net/dafei4/article/details/79494324

 

scp使用

從linux系統複製文件到windows系統:

scp <linux_path> administrator@<windows_ip>:<windows_path>

在linux環境下,將windows下的文件複製到linux系統中:

scp administrator@<windows_ip>:<windows_path> <linux_path>

windows的路徑用'/'作爲分隔符。

請注意:因爲windows系統本身不支持ssh協議,所以,要想上面的命令成功執行,必須在windows客戶端安裝ssh for windows的客戶端軟件,比如winsshd,使windows系統支持ssh協議纔行。

以上的命令我沒試過,以前好像是用putty直接完成的,也不需要輸入命令,可以直接拖拽。

 

linux 到 linux :

scp <src_path> <dest_username>@<dest_ip>:<dest_path>

scp source  destination_username@destination_ip:destination_filepath   #注意#目的地的url路徑中不要漏掉冒號。

 

報錯一:

The authenticity of host '114.212.xx.xx (114.212.xx.xx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? 

解決方法:

不要選擇yes或no,直接ctrl+c。然後輸入下面命令

ssh  -o StrictHostKeyChecking=no  114.212.xx.xx

輸入密碼。接着exit登出,系統輸出以下兩行:

logout
Connection to 114.212.xx.xx closed.

回到了原來的服務器。

接着重新使用scp命令就不會報錯了。

 

報錯二:

.: not a regular file

表明當前目錄不是一個文件,因爲是個文件夾。如果傳送單個文件是不會出錯的。

解決方法:

scp -r <src_path> <dest_username>@<dest_ip>:<dest_path>

加個-r參數就好了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章