linux scp copy files

scp is secure copy, a command used to copy files remotely under linux.

1. Copy the local file to the remote server

$ scp /home/hello.txt [email protected]:/home

 

/home/hello.txt Local file to be copied to the server

root login to the remote server as root user (other users with equivalent privileges can also be used)

192.168.1.188 The ip address of the remote server (domain name or machine name can also be used)

/home/ copies local files to a path located on the remote server

 

2. Copy the files from the remote server to the local machine

$ scp [email protected]:/home/hello.txt /home/

root login to the remote server as root user (other users with equivalent privileges can also be used)

192.168.1.188 The ip address of the remote server (domain name or machine name can also be used)

/home/hello.txt A file located on the remote server to be copied to the local machine

/home/ Copy the remote file to the local absolute path

Note two points:

1. If the remote server firewall has special restrictions, scp will use a special port. The specific port depends on the situation. The command format is as follows:

$ scp -p 4588 [email protected]:/home/hello.txt /home/

2. When using scp, pay attention to whether the user used has the permission to read the corresponding file of the remote server.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326221810&siteId=291194637