- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
Today’s project is both practical and RHCSA-aligned: setting up a secure, automated backup server using rsync over SSH and scheduled jobs with cron.
This is a real-world admin task and also mirrors RHCSA exam scenarios where backup automation and file transfer are common.
? Objective
User and permission management
SSH key authentication
Automating jobs with cron
File transfer with rsync
Firewall configuration
Install rsync
sudo dnf install -y rsync
Check version:
rsync --version
Set Up SSH Key Authentication
On client machine (sending data):
ssh-keygen -t rsa
ssh-copy-id backupuser@backupserver
Now the client can connect without a password:
ssh backupuser@backupserver
Create a Backup Directory on the Server
sudo mkdir -p /backups/home
sudo chown backupuser:backupuser /backups/home
Test rsync Manually
From client to server:
rsync -avh /home/backupuser/Documents/
backupuser@backupserver:/backups/home/
Flags:
-a: archive mode (preserves permissions)
-v: verbose
-h: human-readable output
Automate Backups with cron
On the client:
crontab -e
Add this line to run backup every day at 2 AM:
0 2 * * * rsync -az /home/backupuser/Documents/ backupuser@backupserver:/backups/home/
Check your cron jobs:
crontab -l
Secure the Backup Server
Allow SSH and rsync port (default is SSH):
sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --reload
? Try It Yourself
Recap
? Why This Matters (RHCSA)
Backups are critical for disaster recovery.
This project tested:
This is a real-world admin task and also mirrors RHCSA exam scenarios where backup automation and file transfer are common.
? Objective
- Use rsync to transfer files securely over SSH
- Automate regular backups with cron
- Secure access using SSH keys
- Harden access with firewall and permissions
sudo dnf install -y rsync
Check version:
rsync --version
On client machine (sending data):
ssh-keygen -t rsa
ssh-copy-id backupuser@backupserver
Now the client can connect without a password:
ssh backupuser@backupserver
sudo mkdir -p /backups/home
sudo chown backupuser:backupuser /backups/home
From client to server:
rsync -avh /home/backupuser/Documents/
backupuser@backupserver:/backups/home/
Flags:
-a: archive mode (preserves permissions)
-v: verbose
-h: human-readable output
On the client:
crontab -e
Add this line to run backup every day at 2 AM:
0 2 * * * rsync -az /home/backupuser/Documents/ backupuser@backupserver:/backups/home/
Check your cron jobs:
crontab -l
Allow SSH and rsync port (default is SSH):
sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --reload
? Try It Yourself
- Schedule hourly or weekly backups
- Add logging with rsync -avh --log-file=/var/log/backup.log
- Create a backup rotation script (daily, weekly folders)
- Test by restoring files from the server
| Task | Tool/Command |
|---|---|
| Generate SSH keys | ssh-keygen, ssh-copy-id |
| Create backup folder | mkdir, chown |
| Transfer files securely | rsync -avh source destination |
| Schedule backups | crontab -e |
| Harden backup access | firewalld, SSH key-only login |
? Why This Matters (RHCSA)
Backups are critical for disaster recovery.
This project tested:
- SSH automation
- Cron scheduling
- Firewall management
- Basic scripting and file system management
- All of these are RHCSA core competencies.