Skip to content

Commit 9b8910f

Browse files
rsync_ssh.md (#2473)
Grammar Check
1 parent f4a8c30 commit 9b8910f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

docs/guides/backup/rsync_ssh.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ tags:
1212
This is everything you will need to understand and follow along with this guide:
1313

1414
- A computer running Rocky Linux
15-
- To be comfortable with modifying configuration files from the command-line
15+
- To be comfortable with modifying configuration files from the command line
1616
- Knowledge of how to use a command line editor (using _vi_ here, but you can use your favorite editor)
1717
- You will need root access or `sudo` privileges
1818
- Public and Private SSH key pairs
19-
- Able to create a bash script with `vi` or your favorite editor, and test it.
19+
- Able to create a bash script with `vi` or your favorite editor and test it.
2020
- Able to use `crontab` to automate the running of the script
2121

2222
## Introduction
2323

24-
Using `rsync` over SSH is not as powerful as [lsyncd](../backup/mirroring_lsyncd.md) (which allows you to watch a directory or file for changes and keep it synchronized in real time), nor as flexible as [rsnapshot](../backup/rsnapshot_backup.md) (which offers the ability to backup multiple targets from a single computer). However, it provides the ability to keep two computers up to date on a schedule that you define.
24+
Using `rsync` over SSH is not as powerful as [lsyncd](../backup/mirroring_lsyncd.md) (which allows you to watch a directory or file for changes and keep it synchronized in real-time), nor as flexible as [rsnapshot](../backup/rsnapshot_backup.md) (which offers the ability to backup multiple targets from a single computer). However, it allows you to keep two computers up to date on a schedule you define.
2525

2626
If you need to keep a set of directories on the target computer up to date, and you do not care about real-time synchronization as a feature, then `rsync` over SSH is probably the best solution.
2727

28-
For this procedure, you will be doing things as the root user. Either login as root or use the `sudo -s` command to switch to the root user in your terminal.
28+
For this procedure, you will be working as the root user. Either log in as root or use the `sudo -s` command to switch to the root user in your terminal.
2929

3030
### Installing `rsync`
3131

@@ -35,15 +35,15 @@ Although `rsync` is probably already installed. To ensure that `rsync` is up to
3535
dnf install rsync
3636
```
3737

38-
If the package is not installed, `dnf` will ask you to confirm the installation, if it is already installed, `dnf` will look for an update and prompt to install it.
38+
If the package is not installed, `dnf` will ask you to confirm the installation. If it is already installed, `dnf` will look for an update and prompt you to install it.
3939

4040
### Preparing the environment
4141

4242
This example will use `rsync` on the target computer to pull from the source instead of pushing from the source to the target. You need to set up an [SSH key pair](../security/ssh_public_private_keys.md) for this. After creating the SSH key pair, verify passwordless access from the target computer to the source computer.
4343

4444
### `rsync` parameters and setting up a script
4545

46-
Before script set up continues, you need to decide what parameters you want to use with `rsync`. Many possibilities exist. Review the [manual for rsync](https://linux.die.net/man/1/rsync) for a complete list. The most common way to use `rsync` is to use the `-a` option, because `-a`, or "archive", combines several common options into one. What does `-a` include?
46+
Before the script setup continues, you must decide what parameters to use with `rsync`. Many possibilities exist. Review the [manual for rsync](https://linux.die.net/man/1/rsync) for a complete list. The most common way to use `rsync` is to use the `-a` option, because `-a`, or "archive", combines several common options. What does `-a` include?
4747

4848
- `-r`, recurse the directories
4949
- `-l`, maintains symbolic links as symbolic links
@@ -58,7 +58,7 @@ The only other options that you need to specify in this example are:
5858
- `-e`, specify the remote shell to use
5959
- `--delete`, which says if the target directory has a file in it that does not exist on the source, get rid of it
6060

61-
Next, set up a script on the target computer by creating a file for it (again, use your favorite editor if you are not familiar with `vi`). To create the file, just use this command:
61+
Next, set up a script on the target computer by creating a file for it (again, use your favorite editor if you are unfamiliar with `vi`). To create the file, use this command:
6262

6363
```bash
6464
vi /usr/local/sbin/rsync_dirs
@@ -71,7 +71,7 @@ Add the content:
7171
/usr/bin/rsync -ae ssh --delete [email protected]:/home/your_user /home
7272
```
7373

74-
Replace "source.domain.com" with your own domain name, host name, or IP address.
74+
Replace "source.domain.com" with your domain name, hostname, or IP address.
7575

7676
Make it executable:
7777

@@ -93,15 +93,15 @@ Run the script:
9393
/usr/local/sbin/rsync_dirs
9494
```
9595

96-
If all is well, you will get a completely synchronized copy of your home directory on the target computer. Ensure this is the case.
96+
If all is well, you will get a synchronized copy of your home directory on the target computer. Ensure this is the case.
9797

9898
Assuming all of that worked, create a new file on the source computer in your home directory:
9999

100100
```bash
101101
touch /home/your_user/testfile.txt
102102
```
103103

104-
Run the script again:
104+
Rerun the script:
105105

106106
```bash
107107
/usr/local/sbin/rsync_dirs
@@ -113,7 +113,7 @@ Verify that the target computer receives the new file. If so, the next step is t
113113
rm -f /home/your_user/testfile.txt
114114
```
115115

116-
Run the script again:
116+
Rerun the script:
117117

118118
```bash
119119
/usr/local/sbin/rsync_dirs
@@ -133,13 +133,13 @@ Run the script a final time:
133133
/usr/local/sbin/rsync_dirs
134134
```
135135

136-
The file you created on the target should no-longer exist, because it does not exist on the source.
136+
The file you created on the target should no longer exist because it does not exist on the source.
137137

138-
Assuming all of this worked as expected, change the script to synchronize all the directories that you want.
138+
Assuming all of this worked as expected, change the script to synchronize all the directories you want.
139139

140140
## Automating everything
141141

142-
You probably do not want to manually run this script every time you want to synchronize. Use a `crontab` to do this automatically on a schedule. To run this script at 11 PM every night:
142+
You may not want to run this script every time you want to synchronize manually. Use a `crontab` to do this automatically on a schedule. To run this script at 11 PM every night:
143143

144144
```bash
145145
crontab -e
@@ -175,15 +175,15 @@ This will pull up and look similar to this:
175175

176176
!!! info
177177

178-
The example `crontab` shows an empty, but commented, file. The commenting does not show up on every computer instance and may be an empty file. On an active computer, you may see other entries.
178+
The example `crontab` shows an empty but commented file. The commenting does not appear on every computer instance and may be an empty file. On an active computer, you may see other entries.
179179

180-
The `crontab` is on a 24-hour clock. You will need your entry at the bottom of this file is:
180+
The `crontab` is on a 24-hour clock. You will need your entry at the bottom of this file:
181181

182182
```crontab
183183
00 23 * * * /usr/local/sbin/rsync_dirs
184184
```
185185

186-
What this says is to run this command at 00 minute, 23 h, every day, every month, and every day of the week. Save your `crontab` entry with:
186+
What this says is to run this command at 00 minutes, 23 h, every day, every month, and every day of the week. Save your `crontab` entry with:
187187

188188
++shift+colon+"w"+"q"+exclam++
189189

@@ -198,4 +198,4 @@ What this says is to run this command at 00 minute, 23 h, every day, every month
198198
199199
## Conclusions
200200
201-
Although `rsync` is not as flexible or powerful as other tools, it provides file synchronization, which is always useful.
201+
Although `rsync` is not as flexible or robust as other tools, it provides file synchronization, which is always helpful.

0 commit comments

Comments
 (0)