1.21 Transfer files securely via the network

scp
The SSH service provides a mechanism for securely copying files to and from a remote system. Copying is performed using the scp utility.
To copy a file to a directory on a remote system, execute the following command:

# scp demo.txt username@remoteip:/home/username

Where demo.txt is the name of the file to be uploaded to the remote system, username is the name of user account to be used to log into the remote system, remoteip is replaced by the real IP address or hostname of the system and /home/username represents the directory into which the file should be copied.

The above file could similarly be copied from the remote system to the local system as follows:

# scp username@remoteip:/home/username/demo.txt .

The above command will copy the remote file to the current directory on the local system.

Another way, is rsync utility for efficiently transferring and synchronizing files across computer systems, by checking the timestamp and size of files. It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional compression, and SSH or stunnel can be used for data security.

To copy file to remote system use command

rsync -avP localfile.txt username@remoteip:/home/username/remotefile.txt

To copy file from remote system use command

rsync -avP username@remoteip:/home/username/remotefile.txt localfile.txt

To copy all files from remote system directory use command

rsync -avP username@remoteip:/home/username/remotedir/ ./localdir

CentOS 7

No features.

openSUSE Leap 42.3

No features.

Ubuntu 17.04

No features.

Publication/Release Date: Aug 15, 2017

Advertisement