Use scp to transfer files between servers without Password

Source: Internet
Author: User
Tags scp file scp command secure copy

  1. 1. Run the ssh-keygen-t rsa command on server.
  2. 2. Three carriage returns
  3. 3. In the user's directory ~ /. Ssh/generate two files: id_rsa, id_rsa.pub
  4. 4. Copy the corresponding file under server a to server B and rename it authorized_keys.
    1. Scp/root/. ssh/id_rsa.pub root@10.0.1.22:/root/. ssh/authorized_keys

      1. Scp command:
      2. Scp command description

        Scp-secure copy (remote file copy tool)

        Syntax:

        Scp [-1245 BCpqrv] [-c cipher] [F ssh_config] [-I identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user @] host1:] file1 […] [[Suer @] host2:] file2

        Note:

        Scp Copies files between hosts. It uses ssh (1) for data transmission. And use the same authentication and security. Scp requests for password input during authentication. All files may need a special description from the server and the user to indicate that the file will be copied to/from a server. File Replication between two remote login servers is allowed.

        Option:
        • -1 force scp Protocol 1
        • -2 force scp Protocol 2
        • -4 force scp to use IPV4 URLs
        • -6 force scp to use IPV6 URLs
        • -B. Select the batch processing mode (to prevent password input)
        • -C allows compression. Mark-C to ssh (1) to allow Compression
        • -Cipher: Select cipher to encrypt data transmission. This option is passed directly to ssh (1)
        • -F ssh_config: Set a variable user configuration to ssh. This option will be passed directly to ssh (1)
        • -I identity_file: select the file that is RSA-authenticated to read the private password. This option can be passed directly to ssh (1)
        • -L limit limits the transmission bandwidth, that is, the Kbit/s speed for the speed.
        • -O ssh_option can upload the configuration format in ssh_config to ssh. This mode is helpful for scp that does not have an independent scp file interrupt character.
        • -P port specifies the remote connection port. Note that this option must be written in uppercase. Because-p has reserved the number and mode.
        • -S program specifies an encryption program. This program must read all ssh (1) options.
        • -P specifies the number of modifications, connections, and the mode of the original file.
        • -Q: Turn off the progress parameter.
        • -R Recursively copies the entire folder
        • -S program specifies an encryption program. This program must read all ssh (1) options.
        • -V redundancy mode. Let scp and ssh (1) print their troubleshooting information, which is useful in troubleshooting connections, authentication, and configuration. Example:
        • Copy local directory to remote directory
        • Scp-r/home/test/root@10.0.1.22:/root/

        • Copy a single local file to remote

        • Scp/home/test/test.txt root@10.0.1.22:/root/

        • Remote File Download to local

        • Scp-r root@10.0.1.22:/root // home/test/new/


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.