美文网首页
服务器转移SCP 复制

服务器转移SCP 复制

作者: 福水 | 来源:发表于2018-03-23 11:41 被阅读0次

scp -r /home/ftp/1520/xzr8-20160314-gyq/xxy19.com/ root@118.24.10.231:/www/wwwroot/ceshi/

重装系统后,从另一台机器中scp文件,出现了如下提示,重装前是可以scp的。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!    @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that the RSA host key has just been changed.

The fingerprint for the RSA key sent by the remote host is

62:7c:e9:74:26:2b:58:cb:7c:45:53:6a:65:be:9f:2e.

Please contact your system administrator.

Add correct host key in /root/.ssh/known_hosts to get rid of this message.

Offending key in /root/.ssh/known_hosts:1

RSA host key for 192.168.7.171 has changed and you have requested strict checking.

Host key verification failed.

lost connection

百度了一下,立马解决,又一次真的感谢网络的便捷,网友的无私共享。

方法如下:

在运行scp的机器中,找到该用户家目录下的如下的ssh连接文件夹:

1. cd ~/.ssh/

2. vi known_hosts

3. 找到和远程主机ip一致的密钥保存信息,直接dd(切换到英文键盘直接按)删除,然后:x(切换到英文键盘直接按)保存退出

4. 重新连接,输入密码,发现连接成功

问题解决。原来是记录了重装前的密钥,所以出现错误。删除后重新获取就OK了。

scp的一般命令:

传送文件:  scp filename username@ip:dir,如scp a.txt root@192.168.7.2:/home/aa

传送文件夹:scp -r dir username@ip:dir, 如scp -r bb root@192.168.7.2:/home/aa

利用scp传输文件

  1、从服务器下载文件

  scp username@servername:/path/filename /tmp/local_destination

  例如scp codinglog@192.168.0.101:/home/kimi/test.txt  把192.168.0.101上的/home/kimi/test.txt

  的文件下载到 /tmp/local_destination

  2、上传本地文件到服务器

  scp /path/local_filename username@servername:/path 

  例如scp /var/www/test.php  codinglog@192.168.0.101:/var/www/  把本机/var/www/目录下的test.php文件

  上传到192.168.0.101这台服务器上的/var/www/目录中

  3、从服务器下载整个目录

      scp -r username@servername:remote_dir/ /tmp/local_dir

    例如:scp -r codinglog@192.168.0.101 /home/kimi/test  /tmp/local_dir

  4、上传目录到服务器

      scp  -r /tmp/local_dir username@servername:remote_dir

      例如:

      scp -P 22 -r test      codinglog@192.168.0.101:/var/www/  把当前目录下的test目录上传到服务器

      的/var/www/ 目录

相关文章

  • 服务器转移SCP 复制

    scp -r /home/ftp/1520/xzr8-20160314-gyq/xxy19.com/ root@1...

  • Linux使用综合经验

    scp文件复制: scp能实现将本机的文件复制到服务器,指令如下: screen: 简介:如果要在服务器上跑一个长...

  • mac 复制文件到远端Docker容器步骤

    1、使用scp复制文件到远端服务器: scp /Users/optaim/Desktop/filename use...

  • linux远程拷贝

    从本地服务器复制到远程服务器:(1) 复制文件:命令格式:scp local_file remote_userna...

  • scp详解

    从本地服务器复制到远程服务器: (1)复制文件: 命令格式: scp local_file remote_user...

  • 每日linux命令-SCP

    linux上scp命令基于ssh协议实现服务器间文件和目录的复制(传输)SCP:secure copy用法: 参数...

  • 跨服务器复制文件之scp命令

    scp命令详解—跨服务器复制文件 scp在跨机器复制的时候为了提高数据的安全性,使用了ssh连接和加密方式,如果机...

  • 安装CM

    复制文件到其他服务器: scp cloudera-manager-daemons-6.3.1-1466458.el...

  • 服务器相关的操作

    一,从服务器复制文件到mac本地的linux命令: 格式scp -r 【服务器用户名】@【服务器地址】:【服务器上...

  • SCP命令简单使用

    scp命令的实际应用概述: 从本地服务器复制到远程服务器: (1) 复制文件:命令格式: 第1,2个指定了用户名,...

网友评论

      本文标题:服务器转移SCP 复制

      本文链接:https://www.haomeiwen.com/subject/hpntcftx.html