CentOS uses the sftp command to transfer files between hosts

created at 08-03-2021 views: 11

Sftp is the abbreviation of Secure File Transfer Protocol, a secure file transfer protocol. Can provide a safe encryption method for transferring files. Sftp and ftp have almost the same syntax and functions. SFTP is a part of SSH and is a secure way to transfer files to the Blogger server.

In fact, the SSH software package already contains a secure file transfer subsystem called SFTP (Secure File Transfer Protocol). SFTP itself does not have a separate daemon. It must use the sshd daemon (the port number is 22 by default) to complete the response. The connection operation, so in a sense, SFTP is not like a server program, but more like a client program. SFTP also uses encryption to transmit authentication information and transmitted data, so it is very safe to use SFTP. However, because this transmission method uses encryption/decryption technology, the transmission efficiency is much lower than ordinary FTP. If you have higher requirements for network security, you can use SFTP instead of FTP.

Basic usage

Log in to the host

sftp [host username]@[host IP]

After the login is successful, the following get and send operations can be carried out.

get

get file(s) from remote

#Get a single file
get [remote file path] [local path] 

#Get the entire folder
get -r [remote directory path] [local path]

send

send file(s) to remote

# send a single file
put [local file path] [remote path]

#send the entire folder 
put -r [local directory path] [remote path] 

Get file example

1. Log in to the remote account

Get file example

After entering the sftp command, follow the prompt process to provide password and login successfully, as shown in the figure above.

2. Get a folder remotely

Get the folder remotely

created at:08-03-2021
edited at: 08-03-2021: