One scp for linux Command 1 and scp for linux Command every day

Source: Internet
Author: User
Tags scp command

One scp for linux Command 1 and scp for linux Command every day
There are three common methods to copy files between Linux:

The first is ftp, that is, one of the Linux installation ftpServer, so that another client program using ftp can be used to copy files.

The second method is to use the samba service, similar to the Windows file copy method, which is simple and convenient.

The third is to use the scp command to copy files. Scp is a file copy with security. It is used for ssh-based logon.

Sometimes we need to obtain a file on the remote server. This server is neither configured with an ftp server nor shared. When files cannot be obtained through conventional channels, you only need to use the simple scp command to achieve the goal.

 

1. Copy local files to a remote server

Copy the local file news.txt to the/etc/squid directory on the host 192.168.6.129 (the user name is root ).

# Scp/home/administrator/news.txtroot@192.168.6.129:/etc/squid

/Home/administrator/absolute path of the local file

Copy news.txt to a local file on the server

Root log on to the remote server using the root user (other users with the same permissions can also be used)

IP address of the remote server 192.168.6.129 (domain name or machine name can also be used)

/Etc/squid: copy the local file to the path on the remote server

 

Log on to the remote server as the root user and enter yes to agree to create an ssh connection.

  

Prompt to enter the root user password

  

After the connection is established, the file is transmitted, showing the percentage, actual time, transmission speed, and other information.

 

2. Copy files on the remote server to the Local Machine

# Scp root@192.168.6.129:/usr/local/sin. sh/home/administrator

Root log on to the remote server as the root user

Ip address of the remote server 192.168.6.129

/Usr/local/sin. sh file to be copied to the local Remote Server

/Home/administrator copy the remote file to the local absolute path

 

Note:

1. If the remote server firewall has special restrictions, scp must go through the special port. The specific port used depends on the situation. The command format is as follows:

# Scp-p 4588 remote@www.abc.com:/usr/local/sin. sh/home/administrator

Available parameters-

-V is used to display the progress. It can be used to view the connection, authentication, or configuration error.

-C enable compression options.

-P: select the port. Note that-p has been used by rcp.

-4 Use the IPV4 address forcibly.

-6 Use IPV6 addresses forcibly.

2. When using scp, pay attention to whether the user has the permission to read the corresponding files on the remote server.

 

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.