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参数就好了。

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