zoukankan      html  css  js  c++  java
  • linux文件操作

    scp copies files between hosts on a network.  It uses ssh(1) for data transfer, and uses the same authentication and provides 
    the same securityas ssh(1).

    scp will ask for passwords or passphrases if they are needed for authentication.
    File names may contain a user and host specification to indicate that the file is to be copied to/from that host.

    Local file names can be made explicit using absolute or relative pathnames to avoid scp treating
    file names containing `:' as host specifiers. Copies between two remote hosts are also permitted.

    个人解读:

    (1)scp通过网络在多个主机间拷贝文件(不一定是远端拷贝到本地)

    (2)使用ssh工具的1版本协议做数据传输

    (3)要账号和密码认证

    (4)包含:就算远端机器

    常用例子:

    (1)远程拷贝到本地

       scp remote@www.abc.com:/usr/local/sin.sh /home/administrator
       remote                       通过remote用户登录到远程服务器(也可以使用其他拥有同等权限的用户)
       www.abc.com              远程服务器的域名(当然也可以使用该服务器ip地址)
       /usr/local/sin.sh           欲复制到本机的位于远程服务器上的文件
       /home/administrator  将远程文件复制到本地的绝对路径

    (2)本地拷贝到服务器

      scp /home/administrator/news.txt root@192.168.6.129:/etc/squid
      /home/administrator/      本地文件的绝对路径
      news.txt                          要复制到服务器上的本地文件
      root                                 通过root用户登录到远程服务器(也可以使用其他拥有同等权限的用户)
      192.168.6.129                远程服务器的ip地址(也可以使用域名或机器名)
      /etc/squid                       将本地文件复制到位于远程服务器上的路径 

    备注:

      1.如果远程服务器防火墙有特殊限制,scp便要走特殊端口,具体用什么端口视情况而定,命令格式如下:
      #scp -p 4588 remote@www.abc.com:/usr/local/sin.sh /home/administrator
      2.使用scp要注意所使用的用户是否具有可读取远程服务器相应文件的权限。

  • 相关阅读:
    C
    A
    G
    B
    一些新玩意:
    Angular常用功能
    node学习笔记(四)
    node学习笔记(三)
    node学习笔记(二)
    node学习笔记
  • 原文地址:https://www.cnblogs.com/chendeming/p/8166225.html
Copyright © 2011-2022 走看看