Configure RSYNC and SSH File Management in Linux
In the "Configure RSYNC and SSH File Management in Linux" virtual lab, learners will practice configuring RSYNC and SSH by utilizing rsync server and rsync client machines. The challenges in this hands-on lab are crucial for various IT job roles such as Linux Administrator, System Administrator, and Security Engineer.
One of the most helpful tools System Administrators will ever have on Linux (and other *nix systems) is rsync. As the name suggests, rsync is applied to sync files on remote and local systems. Also, almost every Unix and Linux arrangement comprises the ssh command that is applied to begin the SSH client program. It allows a secure connection to the SSH server on a remote machine. Both of these utilities are crucial for a secure transfer of files within the system.
This IT Pro Challenge virtual lab challenges learners how to configure the RSYNC and SSH File Management in Linux. Other guided challenges in this series are "Get root Credentials in Linux" and "Can You Manage Users in Linux?".
Understand the Scenario:
There are some of the important Linux features that a system administrator should know and understand. Configuration of RSYNC and SSH File is one of them. In this hands-on virtual lab, you are a system administrator for a Linux server. Your job is to manage file transfers to the server. To complete this task, learners will configure the rsync utility and then use rsync to transfer a text file from the server to the client. Next, learners will update the file and then observe the reduced size of the file during a transfer to the client. Finally, they will learn how to transfer a file securely by using the scp utility.
Understand your environment
If a live or home server is used, then moving files between local systems or two remote computers is an essential requirement. In this lab, learners will use a default installation of CentOS 7 Linux with the Server with GUI package installed. To accomplish this task, non-privileged accounts have already been created, and the environment contains two virtual machines called CentOS7-A and CentOS7-B. The CentOS7-A will be the rsync server, and CentOS7-B will be the rsync client.
Install and configure rsync on CentOS7-A
Almost all Linux distributions come with the facility to configure a file-sharing system that enables the various Linux machines to share files easily. In this section of the lab, first, learners will be automatically signed in to the system where they will learn how to:
- Get root privileges and create a directory named /rsync-source at the root of the filesystem.
- Create a text file in /rsync-source directory by using Vim.
- Add the text January, February, March, April, May, and June, entering each word on a separate line and save the changes.
- Verify that the rsync utility is installed.
- Start the service and verify the rsync daemon is running
- Determine the IP address of the server, and then record the address and configure the firewall to permit the rsyncd service.
Transfer a file from the server to the client using rsync
After installing the rsync on CentOS7-A, you will then switch to the CentOS7-B virtual machine to transfer a file from CentOS7-A to CentOS7-B and learn how to run the ls command to verify that file was moved to the specified location. Learners will also confirm the existence of a given file with January, February, March, April, May, June, each listed on a separate line in the file.
Update a file on the client after making edits on the server
Some of the unique features of rsync include: updation of whole directory trees and filesystems and permission to store hard links, file ownership, permissions, devices, and times. These features allow system administrators to update a file on the client after making edits on the server. In this section of the lab, learners will learn how to:
- Switch to the CentOS7-A virtual machine and open the given file by using Vim.
- Add July, August, September, October, November, and December, entering each word on a separate line and save the changes.
- Switch to the CentOS7-B virtual machine and run a particular command to transfer a file from CentOS7-A to CentOS7-B using rsync.
Use scp to copy a single file and a directory between CentOS7-A and CentOS7-B
The scp (secure copy) command in a Linux system is applied to copy file(s) between servers in a safe way. The SCP command or secure copy enables safe transfer of files within the local host and the unknown host or between two remote hosts. In this section of the lab, you will use scp command to copy a given file and a directory between CentOS7-A and CentOS7-B. To complete this challenge, you will first create a directory called /scp-destination on CentOS7-A and assign read, write, and execute permissions to the /scp-destination directory for the owner, group, others. Next, learners will switch to the CentOS7-B virtual machine and use the touch command to create a file named ProprietaryInformation.txt in the home directory of user01. After this, they will learn how to run a particular command to transfer the file to the /scp-destination directory on CentOS7-A and create a directory named SalesReports by using the mkdir command. Finally, they will check that they have transferred the SalesReports directory and its contents securely.
Lab Summary Conclusion
After completing the "Configure RSYNC and SSH File Management in Linux" virtual lab, you will have accomplished the following:
- Transferred a text file to the server by using rsync.
- Updated a file, and then observed the reduced file size of the transfer.
- You have observed that subsequent file transfers include only the changes to the BusinessInfo.txt file, making rsync very efficient.
- Transferred a file by using the scp utility.