Command for file transfer between local PC and Ubuntu server

1 Install SSH (Secure Shell) service to provide remote management services

       SSH refers to Secure Shell. The SSH protocol family is formulated by the Network Working Group of the IETF (Internet Engineering Task Force). The content of the SSH protocol is a security protocol based on the application layer and the transport layer.
       Traditional network service programs, such as FTP, Pop, and Telnet are inherently insecure; because they transmit data, user accounts, and user passwords in plain text on the network, they are vulnerable to man-in-the-middle. Attack by way of attack. It means that there is another person or a machine pretending to be a real server to receive the data sent by the user to the server, and then pretending to be the user to send the data to the real server.

        SSH (Secure Shell) is a relatively reliable protocol that provides security for remote login sessions and other network services. Using the SSH protocol can effectively prevent information leakage in the remote management process. Through SSH, all transmitted data can be encrypted, and DNS spoofing and IP spoofing can also be prevented. SSH has an additional advantage that the transmitted data is compressed, so it can speed up the transmission. SSH has many functions. It can not only replace Telnet, but also provide a secure "channel" for FTP, Pop, and even PPP.


Enter the following command on the terminal of this machine to install:

sudo apt-get install ssh

After the installation is successful, use SSH to remotely log in to the Ubuntu server and

enter the following command in the terminal:

ssh [email protected]

Among them, username is the name of the server and 192.168.0.1 is the IP address of the server


2 Copy files/folders from the remote Ubuntu machine to the local (scp)

Enter the following command in the terminal:

scp -r [email protected]:/home/username/remotefile.txt

Among them,
1) scp is the command, -r is the parameter
2) username is the server account
3) 192.168.0.1 is the ip address of the server to be uploaded
4) /home/username/remotefile.txt is the file that needs to be copied to the machine

 

3 Copy files/folders from local to remote Ubuntu server

Enter the following command in the terminal:

scp -r localfile.txt [email protected]:/home/username/

Among them,
1) scp is the command, -r is the parameter
2) localfile.txt is the path and file name of the file
3) username is the server account
4) 192.168.0.1 is the server ip address to upload
5) /home/username/ is Folder path to copy in

Guess you like

Origin blog.csdn.net/qq_40716944/article/details/89676829