diff --git a/docs/books/admin_guide/00-toc.zh.md b/docs/books/admin_guide/00-toc.zh.md
index 490f0eb040..3ff9284604 100644
--- a/docs/books/admin_guide/00-toc.zh.md
+++ b/docs/books/admin_guide/00-toc.zh.md
@@ -10,7 +10,7 @@ title: 使用 Rocky 学习 Linux
然后,我们将了解掌握Linux所必需的用户命令。 经验更丰富的用户还应查阅专门介绍更"高级"的"命令"章节
-接下来是关于 VI 编辑器的章节。 虽然Linux附带了许多编辑器,但VI是最强大的编辑器之一。 其他命令有时使用与VI相同的语法(想起了`sed`)。 因此,了解一些关于VI的知识,或者至少了解其基本功能(如何打开文件、保存、退出或不保存而退出),是非常重要的。 用户在使用编辑器的过程中,会对VI的其他功能更加熟悉。 另一种选择是使用默认安装在Rocky Linux中的nano, 虽然功能不多,但它使用简单、直观,并且能完成工作。 虽然功能不多,但它使用简单、直观,并且能完成工作。
+接下来是关于 VI 编辑器的章节。 虽然Linux附带了许多编辑器,但VI是最强大的编辑器之一。 其他命令有时使用与VI相同的语法(想起了`sed`)。 因此,了解一些关于VI的知识,或者至少了解其基本功能(如何打开文件、保存、退出或不保存而退出),是非常重要的。 用户在使用编辑器的过程中,会对VI的其他功能更加熟悉。 另一种选择是使用默认安装在Rocky Linux中的nano, 虽然功能不多,但它使用简单、直观,并且能完成工作。
接着,我们可以深入了解Linux的深层功能,以了解系统是如何管理的:
@@ -18,10 +18,10 @@ title: 使用 Rocky 学习 Linux
* 文件系统
* 进程
-接下来,我们将介绍对系统管理员来说一个极其重要的课程: 备份进程。 Linux附带了许多软件解决方案来加强备份(rsnapshot、lsyncd等),了解操作系统中这些备份的重要组件是有好处的。 在本章中,我们将研究两个工具: `tar` 和不太常用的 `cpio`
+接下来,我们将介绍对系统管理员来说一个极其重要的课程: 备份进程。 Linux附带了许多软件解决方案来加强备份(rsnapshot、lsyncd等),了解操作系统中这些备份的重要组件是有好处的。 在本章中,我们将研究两个工具: `tar` 和不太常用的 `cpio`。
自从systemd出现后,系统在引导过程中的管理在最近几年已经有了很大的发展。
-最后,我们将研究任务的管理、网络的实现和软件的安装。
+最后,我们将研究任务管理、网络实现和软件安装。
diff --git a/docs/books/admin_guide/01-presentation.pt.md b/docs/books/admin_guide/01-presentation.pt.md
new file mode 100644
index 0000000000..e958ded56a
--- /dev/null
+++ b/docs/books/admin_guide/01-presentation.pt.md
@@ -0,0 +1,304 @@
+---
+title: Introdução ao Linux
+---
+
+# Introdução ao Sistema Operacional Linux
+
+Neste capítulo você aprenderá sobre as distribuições GNU/Linux.
+
+****
+
+**Objetivos** : Neste capítulo você vai aprender como:
+
+:heavy_check_mark: Descrever os recursos e possíveis arquiteturas de um sistema operacional
+:heavy_check_mark: Recordar a História do UNIX e GNU/Linux
+:heavy_check_mark: Escolher a distribuição Linux mais adequada para suas necessidades
+:heavy_check_mark: Explicar a filosofia do software livre
+:heavy_check_mark: Compreender a utilidade do SHELL.
+
+:checkered_flag: **generalidades** **, ** linux**, **distribuições**
+
+**Conhecimento**: :star:
+
+**Complexidade**: :star:
+
+**Tempo de leitura**: 10 minutos
+
+****
+
+## O que é um sistema operacional?
+
+Linux, UNIX, BSD, Windows e MacOS são todos **sistemas operacionais**.
+
+!!! Um sistema operacional é um **conjunto de programas que gerencia os recursos disponíveis em um computador**.
+
+Entre esta gestão de recursos, o sistema operacional tem de:
+
+* Gerenciar a memória física ou virtual.
+ * A **memória física** é composta pelas barras de memória RAM e pela memória cache do processador, que é usada para a execução de programas.
+ * A **memória virtual** é um local no disco rígido (a **partição swap**) que permite descarregar o conteúdo da memória física e salvar do estado atual do sistema durante o desligamento elétrico do computador.
+* Gerenciar o acesso aos** periféricos de entrada e saída**. O software raramente tem permissão para acessar hardware diretamente (exceto para placas gráficas em necessidades muito específicas).
+* Fornecer aplicativos com **gerenciamento de tarefas** adequado. O sistema operacional é responsável por agendar processos para ocupar o uso do processador.
+* **Proteger arquivos** contra acesso não autorizado.
+* **Coletar informações** sobre programas em uso ou em andamento.
+
+
+
+## Generalidades UNIX - GNU/Linux
+
+### História
+
+#### UNIX
+
+* De **1964 a 1968**: MULTICS (Serviço de Informação e Computação MULTiplexado) é desenvolvido para MIT, Bell Labs (AT&T) e General Electric.
+
+* **1969**: Depois que Bell Labs (1969) e da General Electric saíram do projeto, dois desenvolvedores (Ken Thompson e Dennis Ritchie), posteriormente reunido por Brian Kernighan, que considera os MULTICS muito complexos, lançou o desenvolvimento do UNIX (Serviço de Informação e Computação UNIplexado). Originalmente foi desenvolvido em *assembler*, entretanto os desenvolvedores da UNIX desenvolveram a linguagem de programação B e, depois, a linguagem C (1971) e reescreveram completamente o UNIX. Tendo sido desenvolvida em 1970, a data de referência dos sistemas UNIX/Linux ficou estabelecida em Janeiro de 1970.
+
+A linguagem C ainda é uma das linguagens de programação mais populares do mundo! Uma linguagem de baixo nível, perto do *hardware*, permite a adaptação do sistema operacional a qualquer arquitetura de máquinas que tenha um compilador de C.
+
+O UNIX é um sistema operacional aberto e em evolução que desempenhou um papel importante na história da computação. Tem sido a base para muitos outros sistemas operacionais como Linux, BSD, MacOS, etc.
+
+O UNIX ainda é relevante nos dias de hoje (HP-UX, AIX, Solaris, etc.)
+
+#### Minix
+
+* **Complexidade**: :star: **1987**: A.S. Tanenbaum desenvolve MINIX, um UNIX simplificado, com o intuito de ensinar os sistemas operacionais de uma forma simples. O Sr. Tanenbaum disponibiliza o código fonte do seu sistema operacional.
+
+#### Linux
+
+* **1991**: Um estudante finlandês, **Linus Torvalds**, cria um sistema operacional dedicado ao seu computador pessoal e o nomeia como Linux. Ele publica a sua primeira versão 0.02, no fórum de discussão Usenet e outros desenvolvedores vêm para ajudá-lo a melhorar o seu sistema. O termo Linux é uma combinação de palavras entre o primeiro nome do fundador, Linus, e UNIX.
+
+* **1993**: a distribuição do Debian é criada. Debian é uma distribuição não comercial mantida pela comunidade. Originalmente desenvolvido para uso em servidores, é particularmente adequado para esse papel. Mas destina-se a ser um sistema universal, e portanto utilizável também num computador pessoal. O Debian é usado como base para muitas outras distribuições, como Linux Mint e Ubuntu.
+
+* **1994**: a distribuição comercial do RedHat é criada pela empresa RedHat, que é hoje o principal distribuidor do sistema operacional GNU/Linux. RedHat suporta a versão comunitária Fedora e, recentemente, a distribuição livre CentOS.
+
+* **1997**: O ambiente gráfico KDE foi criado. Ele é baseado na biblioteca de componentes Qt e na linguagem de programação C++.
+
+* **1999**: O ambiente gráfico Gnome foi criado. Ele é baseado na biblioteca de componentes GTK+.
+
+* **2002**: a distribuição Arch foi criada. Sua particularidade é ser uma distribuição Rolling Release(com atualizações contínuas).
+
+* **2004**: Ubuntu é criado pela empresa Canonical (Mark Shuttleworth). Baseia-se em Debian, entretanto inclui tanto software livre quanto proprietário.
+
+* **2021**: Nascimento do Rocky Linux, baseado na distribuição RedHat.
+
+### Participação no mercado
+
+
+
+O Linux ainda não é bem conhecido pelo público em geral, embora o mesmo o utilize regularmente. Na verdade, o Linux está escondido em **smartphones**, **televisões**, **modens de internet**, etc. Quase **70% das páginas da web** no mundo estão hospedadas em um servidor Linux ou UNIX! Quase **70% das páginas da web** no mundo estão hospedadas em um servidor Linux ou UNIX!
+
+O Linux está presente em pouco mais de **3% dos computadores pessoais**, mas em mais de **82% dos smartphones**. O **Android** é um sistema operacional cujo kernel é Linux.
+
+
+
+Linux está presente em 100% dos supercomputadores desde 2018. Um supercomputador é um computador projetado para alcançar o maior desempenho possível com as técnicas conhecidas no momento de seu design, especialmente no que diz respeito à velocidade da computação.
+
+### Arquitetura do Linux
+
+* O **kernel** é o primeiro componente de software.
+ * É o núcleo do sistema Linux.
+ * Ele gerencia os recursos de hardware do sistema.
+ * Os outros componentes do software devem passar por ele para acessar o hardware.
+* O shell **** é um utilitário que interpreta comandos do usuário e garante sua execução.
+ * Principais Shells: Bourne shell, C shell, Korn shell e Bourne-Again shell (bash).
+* Aplicativos são programas do usuário como:
+ * Navegador de Internet;
+ * Processadores de Texto;
+ * ...
+
+#### Multitarefa
+
+O Linux pertence à família de sistemas operacionais de compartilhamento de tempo. Ele compartilha o tempo de processo entre vários programas, mudando de um para outro de forma transparente para o usuário. Isso implica:
+
+* execução simultânea de vários programas;
+* distribuição do tempo de uso da CPU pelo gerenciador de tarefas;
+* redução de problemas devido a uma aplicação com falhas;
+* redução de desempenho quando muitos programas são executados.
+
+#### Múltiplos usuários
+
+O propósito das Multices era permitir que vários usuários trabalhassem de vários terminais (tela e teclado) em um único computador (muito caro na época). Linux, que é inspirado neste sistema operacional, manteve esta habilidade de trabalhar com vários usuários simultaneamente e independentemente, cada um tem sua própria conta de usuário, espaço de memória e acesso a arquivos e software.
+
+#### Multiprocessadores
+
+O Linux é capaz de trabalhar com computadores multi-processadores ou processadores multi-núcleos(com mais de um núcleo).
+
+#### Multiplataforma
+
+O Linux é escrito em uma linguagem de alto nível que pode ser adaptada a diferentes tipos de plataformas durante sua compilação. Portanto, ele funciona em:
+
+* computadores domésticos (PC ou laptop);
+* servidores (dados, aplicações,...);
+* computadores portáteis (smartphones ou tablets)
+* sistemas embarcados (computador de carro e máquinas)
+* elementos de rede ativos (roteadores, interruptores)
+* electrodomésticos (TVs, refrigeradores,...).
+
+#### Aberto
+
+O Linux é baseado em padrões reconhecidos [posix](http://fr.wikipedia.org/wiki/POSIX), TCP/IP, NFS, Samba ... permitindo compartilhar dados e serviços com outros sistemas de aplicativo.
+
+### A filosofia UNIX/Linux
+
+* Tudo é um arquivo.
+* Portabilidade.
+* Faça apenas uma coisa e faça isso bem.
+* KISS: Mantenha Isso Simples Estupido(Keep It Simple Stupid).
+* "A UNIX é basicamente um sistema operacional simples, mas é preciso ser um gênio para entender a simplicidade." (__Dennis Ritchie__)
+* "Unix é amigável ao usuário. No entanto, não específica quais usuários serão amigáveis com o sistema." (__Steven King__)
+
+## As distribuições GNU/LINUX
+
+Uma distribuição Linux é um **conjunto consistente de software** montado em torno kernel do Linux e pronto para ser instalado juntamente com os componentes necessários para gerenciar este software (instalação, remoção, configuração). Existem **distribuições associativas ou comunitárias** (Debian, Rocky) ou **comerciais** (RedHat, Ubuntu).
+
+Cada distribuição oferece um ou mais **ambientes de trabalho**(ambiente gráfico), fornece um conjunto de softwares pré-instalados e uma biblioteca de software adicional. Opções de configuração (configurações do kernel ou opções de serviços, por exemplo) são específicas para cada distribuição.
+
+Este princípio permite que você tenha distribuições orientadas para **iniciantes** (Ubuntu, Linux Mint...), outras com uma abordagem mais complexa (Gentoo, Arch), algumas com foco em **servidores** (Debian, Redhat) e até mesmo distribuições dedicadas a **estações de trabalho**.
+
+### Ambientes de Trabalho(Ambiente Gráfico)
+
+Existem diversos ambientes gráficos: **Gnome**, **KDE**, **LXDE**, **XFCE**, etc. Há interfaces para todos tipos de pessoas, e sua **ergonomia** não perde em nada para os sistemas Microsoft ou Apple!
+
+Então, por que há tão pouco entusiasmo para o Linux sendo que **não há(ou é pouco presente) vírus para esse sistema**? Talvez porque todos os editores(Adobe) ou fabricantes(Nvidia) não jogam o jogo gratuito e dessa forma não fornecem uma versão do seu software compatível com GNU/Linux? Medo da mudança? A dificuldade de onde encontrar e comprar um computador com Linux? Poucos jogos(Mas não por muito tempo) distribuídos no Linux? Essa situação vai mudar com a chegada do console de jogos steam-box que roda com Linux?
+
+
+
+O ambiente gráfico **Gnome 3** não usa mais o conceito de Área de Trabalho(Desktop), mas sim o Gnome Shell(não confundir com o shell da linha de comando). Ele serve como área de trabalho, painel de controle, área de notificações e um seletor de janela. O ambiente gráfico Gnome é baseado na biblioteca de componentes GTK+.
+
+
+
+O ambiente gráfico **KDE** é baseado na biblioteca de componentes **Qt**.
+
+Ele é mais recomendado para usuários que estão migrando do mundo Windows para o Linux.
+
+
+
+### Livre / Código Aberto
+
+Um usuário de um sistema operacional Windows ou Mac deve comprar uma licença para o uso legal do sistema operacional. Essa licença tem um custo, embora geralmente seja oculto ao comprador(o preço da licença está incluído no preço do computador).
+
+No universo **GNU/Linux**, o movimento Software Livre fornece principalmente distribuições livres.
+
+**Grátis** não significa livre!
+
+**Código Aberto**: os códigos-fonte estão disponíveis, por isso é possível consultá-los e modificá-los sob certas condições.
+
+Um software livre é necessariamente Código Aberto, mas o oposto não é verdade, uma vez que um software código aberto é separado da liberdade proposta pela licença GPL.
+
+#### Licença GPL (General Public License)
+
+A **Licença GPL** garante ao autor de um software sua propriedade intelectual, mas permite modificação, redistribuição ou revenda do software por terceiros, desde que os códigos-fonte sejam fornecidos com o software. O GPL é a licença que saiu do projeto **GNU** (GNU não é UNIX), que foi fundamental na criação do Linux.
+
+Isso implica:
+
+* a liberdade de executar o programa, para qualquer finalidade;
+* a liberdade de estudar como o programa funciona e adaptá-lo às suas necessidades;
+* a liberdade de redistribuir cópias;
+* a liberdade de melhorar o programa e publicar suas melhorias em benefício de toda a comunidade.
+
+Por outro lado, até mesmo produtos licenciados sob o GPL podem ser pagos. Este não é o produto em si, mas a garantia de que uma equipe de desenvolvedores continuará trabalhando nele para fazê-lo evoluir e solucionar problemas, ou mesmo fornecer suporte aos usuários.
+
+## Áreas de uso
+
+Uma distribuição Linux se destaca em :
+
+* **Servidores**: HTTP, email, groupware, compartilhamento de arquivo, etc.
+* **Segurança**: Gateway, firewall, roteador, proxy, etc.
+* **Computador central**: Bancos, seguros, indústria, etc.
+* **Sistema embarcado**: roteadores, Internet boxes, SmartTV, etc.
+
+O Linux é uma escolha adequada para hospedar bancos de dados ou sites, ou como um servidor de e-mail, DNS ou firewall. Em suma, o Linux pode fazer qualquer coisa, o que explica a quantidade de distribuições específicas.
+
+## Shell
+
+### Generalidades
+
+O **shell**, conhecido como _linha de comando_, permite que os usuários enviem comandos para o sistema operacional. É menos visível hoje, desde a implementação de ambientes gráficos, mas continua sendo um meio privilegiado em sistemas Linux, onde nem todos possuem interfaces gráficas e cujos serviços nem sempre têm uma interface de configuração.
+
+Oferece uma linguagem de programação real, incluindo as estruturas clássicas: laços de repetição, estruturas condicionais e os constituintes comuns: variáveis, passagem de parâmetros e subprogramas. Permite a criação de scripts para automatizar determinadas ações (backups, criação de usuários, monitoramento de sistemas, etc.).
+
+Existem vários tipos de shells disponíveis e configuráveis em uma plataforma ou de acordo com a preferência do usuário:
+
+* sh, the POSIX standard shell ;
+* csh, command-oriented shell in C ;
+* bash, Bourne-Again Shell, Linux shell.
+* etc, ...
+
+## Funcionalidades
+
+* Execução de comando (verifica o comando dado e o executa);
+* Redirecionamento de entrada/saída (retorna dados a um arquivo em vez de escrevê-lo na tela);
+* Processo de conexão (gerencia a conexão do usuário);
+* Linguagem de programação interpretada (permitindo a criação de scripts);
+* Variáveis de ambiente (acesso a informações específicas do sistema durante a operação).
+
+### Princípio
+
+
+
+## Verifique seu conhecimento
+
+:heavy_check_mark: Um sistema operacional é um conjunto de programas para gerenciar os recursos disponíveis de um computador:
+
+- [ ] Verdadeiro
+- [ ] Falso
+
+:heavy_check_mark: O sistema operacional tem como função:
+
+- [ ] Gerenciar a memória física e virtual
+- [ ] Permitir acesso direto aos periféricos
+- [ ] Subcontratar o gerenciamento de tarefas para o processador
+- [ ] Coletar informações sobre os programas utilizados ou em uso
+
+:heavy_check_mark: Dentre essas personalidades, quais participaram do desenvolvimento do UNIX:
+
+- [ ] Linus Torvalds
+- [ ] Ken Thompson
+- [ ] Lionel Richie
+- [ ] Brian Kernighan
+- [ ] Andrew Stuart Tanenbaum
+
+:heavy_check_mark: A nacionalidade original de Linus Torvalds, criador do kernel Linux, é:
+
+- [ ] Sueco
+- [ ] Finlandês
+- [ ] Norueguês
+- [ ] Flamengo(Flemish)
+- [ ] Francês
+
+:heavy_check_mark: Quais das seguintes distribuições é a mais antiga:
+
+- [ ] Debian
+- [ ] Slackware
+- [ ] RedHat
+- [ ] Arch
+
+:heavy_check_mark: O Kernel Linux é:
+
+- [ ] Multitarefa
+- [ ] Multi-usuário
+- [ ] Multiprocessador
+- [ ] Multi-core
+- [ ] Multiplataforma
+- [ ] Aberto
+
+:heavy_check_mark: Um software livre é necessariamente de código aberto?
+
+- [ ] Verdadeiro
+- [ ] Falso
+
+:heavy_check_mark: O software de código aberto é necessariamente gratuito?
+
+- [ ] Verdadeiro
+- [ ] Falso
+
+:heavy_check_mark: Qual das seguintes opções não é um shell:
+
+- [ ] Jason
+- [ ] Jason-Bourne shell (jbsh)
+- [ ] Bourne-Again shell (bash)
+- [ ] C shell (csh)
+- [ ] Korn shell (ksh)
diff --git a/docs/books/admin_guide/03-commands.fr.md b/docs/books/admin_guide/03-commands.fr.md
index a18af59929..2d800d8e90 100644
--- a/docs/books/admin_guide/03-commands.fr.md
+++ b/docs/books/admin_guide/03-commands.fr.md
@@ -1256,7 +1256,7 @@ $ ftp -in serverftp << ftp-commands.txt
La redirection d’entrée peut également être utilisée pour simuler une interactivité avec l’utilisateur. La commande lira le flux d’entrée jusqu’à rencontrer le mot clef défini après la redirection d’entrée.
-Le shell quitte la commande `ftp` lorsqu’il reçoit une ligne ne contenant que le mot clef.
+Cette fonctionnalité est utilisée pour scripter des commandes interactives :
```bash
$ ftp -in serverftp << END
@@ -1276,13 +1276,13 @@ bye
STOP
```
-La redirection de l’entrée standard est peu utilisée car la plupart des commandes acceptent un nom de fichier en argument.
+Le shell quitte la commande `ftp` lorsqu’il reçoit une ligne ne contenant que le mot clef.
!!! Warning Le mot clé de fin, ici `END` ou `STOP`, pour terminer la commande doit être le seul mot de la ligne et doit être au début de sa ligne.
-Les sorties standards peuvent être redirigées vers d’autres fichiers grâce aux caractères `>` or `>>`.
+La redirection de l’entrée standard est peu utilisée car la plupart des commandes acceptent un nom de fichier en argument.
-La redirection simple `>` écrase le contenu du fichier de sortie :
+La commande `wc` pourrait s’utiliser ainsi :
```bash
$ wc -l .bash_profile
@@ -1293,9 +1293,9 @@ $ wc -l < .bash_profile
### Les redirections de sortie
-alors que la redirection double `>>` ajoute (concatène) au contenu du fichier de sortie.
+Les sorties standards peuvent être redirigées vers d’autres fichiers grâce aux caractères `>` or `>>`.
-Dans les deux cas, le fichier est automatiquement créé lorsqu’il n’existe pas.
+La redirection simple `>` écrase le contenu du fichier de sortie :
```bash
$ date +%F > date_file
@@ -1307,7 +1307,7 @@ alors que la redirection double `>>` ajoute (concatène) au contenu du fichier d
$ date +%F >> date_file
```
-Redirection de 2 sorties vers 2 fichiers :
+Dans les deux cas, le fichier est automatiquement créé lorsqu’il n’existe pas.
La sortie d’erreur standard peut être également redirigée vers un autre fichier. Cette fois-ci, il faudra préciser le numéro du canal (qui peut être omis pour les canaux 0 et 1) :
@@ -1318,7 +1318,7 @@ $ ls -R / 2>> errors_file
### Exemples de redirections
-Redirection de *stderr* vers un "puits sans fond" (`/dev/null`) :
+Redirection de 2 sorties vers 2 fichiers :
```bash
$ ls -R / >> ok_file 2>> nok_file
@@ -1330,7 +1330,7 @@ Redirection des 2 sorties vers un fichier unique :
$ ls -R / >> log_file 2>&1
```
-Un tube (**pipe** en anglais) est un mécanisme permettant de relier la sortie standard d’une première commande vers l’entrée standard d’une seconde.
+Redirection de *stderr* vers un "puits sans fond" (`/dev/null`) :
```bash
$ ls -R / 2>> /dev/null
@@ -1346,37 +1346,37 @@ Cette communication est monodirectionnelle et se fait grâce au symbole `|`. Le

-N'afficher que le début :
+Toutes les données envoyées par la commande à gauche du tube à travers le canal de sortie standard sont envoyées au canal d’entrée standard de la commande placée à droite.
-N'afficher que la fin :
+Les commandes particulièrement utilisées après un pipe sont des filtres.
* Exemples :
-Trier le résultat :
+N'afficher que le début :
```bash
$ ls -lia / | head
```
-Compter le nombre de mots / caractères :
+N'afficher que la fin :
```bash
$ ls -lia / | tail
```
-Chercher une chaîne de caractères dans le résultat :
+Trier le résultat :
```bash
$ ls -lia / | sort
```
-La commande `tee` permet de rediriger la sortie standard d’une commande vers un fichier tout en maintenant l’affichage à l’écran.
+Compter le nombre de mots / caractères :
```bash
$ ls -lia / | wc
```
-Elle est combinée avec le pipe `|` pour recevoir en entrée la sortie de la commande à rediriger :
+Chercher une chaîne de caractères dans le résultat :
```bash
$ ls -lia / | grep fichier
@@ -1386,20 +1386,20 @@ $ ls -lia / | grep fichier
### La commande `tee`
-L’option `-a` permet d’ajouter au fichier au lieu de l’écraser.
+La commande `tee` permet de rediriger la sortie standard d’une commande vers un fichier tout en maintenant l’affichage à l’écran.
-Utiliser les **alias** est un moyen pour demander au shell de se souvenir d’une commande particulière avec ses options et lui donner un nom.
+Elle est combinée avec le pipe `|` pour recevoir en entrée la sortie de la commande à rediriger :
```bash
$ ls -lia / | tee fic
$ cat fic
```
-Par exemple :
+L’option `-a` permet d’ajouter au fichier au lieu de l’écraser.
### Les commandes `alias` et `unalias`
-remplacera la commande :
+Utiliser les **alias** est un moyen pour demander au shell de se souvenir d’une commande particulière avec ses options et lui donner un nom.
Par exemple :
@@ -1407,7 +1407,7 @@ Par exemple :
$ ll
```
-Les alias ne sont définis que de façon temporaire, le temps de la session utilisateur.
+remplacera la commande :
```bash
$ ls -l
@@ -1426,7 +1426,7 @@ alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-ti
Les alias ne sont définis que de façon temporaire, le temps de la session utilisateur.
-La commande `unalias` permet de supprimer les alias.
+Pour une utilisation permanente, il faut les créer dans le fichier :
* `.bashrc` du répertoire de connexion de l’utilisateur ;
* `/etc/profile.d/alias.sh` pour tous les utilisateurs.
@@ -1437,35 +1437,35 @@ La commande `unalias` permet de supprimer les alias.
alias cd='rm -Rf'
```
-Pour supprimer tous les alias:
+La commande `unalias` permet de supprimer les alias.
-Pour désactiver un alias temporairement, la combinaison est `\`.
+Pour supprimer un seul alias :
```bash
$ unalias ll
```
-Par exemple, si nous faisons:
+Pour supprimer tous les alias:
```bash
$ unalias -a
```
-il pourrait nous retourner :
+Pour désactiver un alias temporairement, la combinaison est `\`.
-Maintenant que nous savons que c'est le cas, nous pouvons voir les résultats de l'utilisation de l'alias ou le désactiver une fois avec le `\` en exécutant les commandes suivantes :
+Par exemple, si nous faisons:
```bash
$ type ls
```
-Colorise le résultat de la commande `grep` : `alias grep='grep --color=auto'`
+il pourrait nous retourner :
```bash
ls is an alias to « ls -rt »
```
-Il est fréquent de créer un dossier puis de se déplacer dedans : `mcd() { mkdir -p "$1"; cd "$1"; }`
+Maintenant que nous savons que c'est le cas, nous pouvons voir les résultats de l'utilisation de l'alias ou le désactiver une fois avec le `\` en exécutant les commandes suivantes :
```bash
$ ls file* # order by time
@@ -1478,23 +1478,23 @@ file1.txt file2.txt file3.txt
* alias `grep`.
-Se déplacer dans un dossier et lister son contenu : `cls() { cd "$1"; ls; }`
+Colorise le résultat de la commande `grep` : `alias grep='grep --color=auto'`
* fonction `mcd`
-Créer une copie de sauvegarde d’un fichier : `backup() { cp "$1"{,.bak}; }`
+Il est fréquent de créer un dossier puis de se déplacer dedans : `mcd() { mkdir -p "$1"; cd "$1"; }`
* fonction `cls`
-Extrait tout type d’archive :
+Se déplacer dans un dossier et lister son contenu : `cls() { cd "$1"; ls; }`
* fonction `backup`
-Alors nous pouvons utiliser cmount pour afficher tous les montages système dans des colonnes comme ceci : `[root]# cmount`
+Créer une copie de sauvegarde d’un fichier : `backup() { cp "$1"{,.bak}; }`
* fonction `extract`
-qui retournera les système de fichiers montés comme ceci :
+Extrait tout type d’archive :
```bash
extract () {
@@ -1523,9 +1523,9 @@ extract () {
* Si `alias cmount` renvoie le résultat suivant : `alias cmount="mount | column -t"`
-Le caractère`;` chaîne les commandes.
+Alors nous pouvons utiliser `cmount` pour afficher tous les montages système dans des colonnes comme ceci : `[root]# cmount`
-Les commandes s’exécuteront toutes séquentiellement dans l’ordre de saisie une fois que l’utilisateur aura appuyé sur ENTREE.
+qui retournera les système de fichiers montés comme ceci :
```bash
/dev/simfs on / type simfs (rw,relatime,usrquota,grpquota)
@@ -1539,9 +1539,9 @@ none on /proc/sys/fs/binfmt_misc type binfmt_misc (r
### Le caractère `;`
-La commande `wc` pourrait s’utiliser ainsi :
+Le caractère`;` chaîne les commandes.
-:heavy_check_mark: Qu’est ce qui caractérise une option longue pour une commande ?
+Les commandes s’exécuteront toutes séquentiellement dans l’ordre de saisie une fois que l’utilisateur aura appuyé sur ENTREE.
```bash
$ ls /; cd /home; ls -lia; cd /
@@ -1551,9 +1551,9 @@ $ ls /; cd /home; ls -lia; cd /
:heavy_check_mark: Qu’est ce qui défini un utilisateur sous Linux ? (7 réponses)
-:heavy_check_mark: Quelle commande permet de visualiser l’historique d’un utilisateur ?
+:heavy_check_mark: Qu’est ce qui caractérise une option longue pour une commande ?
-:heavy_check_mark: Quelle commande permet de rechercher du texte dans un fichier ?
+:heavy_check_mark: Quelles commandes permettent de rechercher de l’aide sur une commande ?
- [ ] `google`
- [ ] `chuck --norris`
@@ -1561,19 +1561,19 @@ $ ls /; cd /home; ls -lia; cd /
- [ ] `apropos`
- [ ] `whatis`
-:heavy_check_mark: Quelle commande permet de rechercher un fichier ?
+:heavy_check_mark: Quelle commande permet de visualiser l’historique d’un utilisateur ?
-:heavy_check_mark: Quelle commande redirige le flux des erreurs d’une commande vers un nouveau fichier `errors.log` :
+:heavy_check_mark: Quelle commande permet de rechercher du texte dans un fichier ?
- [ ] `find`
- [ ] `grep`
-:heavy_check_mark: Quelles commandes permettent de rechercher de l’aide sur une commande :
+:heavy_check_mark: Quelle commande permet de rechercher un fichier ?
- [ ] `find`
- [ ] `grep`
-:heavy_check_mark: Which command redirects the error stream of a command to a new `errors.log` file:
+:heavy_check_mark: Quelle commande redirige le flux des erreurs d’une commande vers un nouveau fichier `errors.log` ?
- [ ] `ls -R / 2> errors.log`
- [ ] `ls -R / 2>> errors.log`
diff --git a/docs/books/admin_guide/05-vi.fr.md b/docs/books/admin_guide/05-vi.fr.md
index b9edd1bc20..7e070ce9a5 100644
--- a/docs/books/admin_guide/05-vi.fr.md
+++ b/docs/books/admin_guide/05-vi.fr.md
@@ -1,480 +1,480 @@
---
-title: VI Text Editor
+title: Éditeur de texte VI
---
-# VI Text Editor
+# Éditeur de texte VI
-In this chapter you will learn how to work with the VIsual editor.
+Dans ce chapitre, vous allez apprendre à travailler avec l'éditeur VIsual.
****
-**Objectives** : In this chapter, future Linux administrators will learn how to:
+**Objectifs** : Dans ce chapitre, les futurs administrateurs Linux vont apprendre comment :
-:heavy_check_mark: Use the main commands of the VI editor;
-:heavy_check_mark: Modify a text with the VI editor.
+:heavy_check_mark: Utiliser les principales commandes de l’éditeur VI ;
+:heavy_check_mark: Modifier un texte grâce à l’éditeur VI.
-:checkered_flag: **user commands**, **linux**
+:checkered_flag: **commandes utilisateurs**, **linux**
-**Knowledge**: :star:
-**Complexity**: :star: :star:
+**Connaissances : ** :star:
+**Complexité : ** :star: :star:
**Temps de lecture : **20 minutes
****
-*Visual* (**VI**) is a very popular text editor under Linux, despite its limited ergonomics. It is indeed an editor entirely in text mode: each action is done with a key on the keyboard or dedicated commands.
+*Visual* (**VI**) est un éditeur de texte très populaire sous Linux malgré une ergonomie qui semble limitée. C’est en effet un éditeur entièrement en mode texte : chacune des actions se faisant avec une touche du clavier ou des commandes dédiées.
-Very powerful, it is above all very practical since it is on the whole minimal for basic applications. It is therefore accessible in case of system failure. Its *universality* (it is present on all Linux distributions and under Unix) makes it a *crucial* tool for the administrator.
+Très puissant, il est surtout très pratique puisqu’il est dans l’ensemble minimal des applications de base. Il est donc accessible en cas de défaillance du système. Son *universalité* (il est présent sur toutes les distributions Linux et sous Unix) en fait un outil *incontournable* de l’administrateur.
-Its functionalities are:
+Ses fonctionnalités sont :
-* Insert, delete, modify text;
-* Copy words, lines or blocks of text;
-* Search and replace characters.
+* Insertion, suppression, modification de texte ;
+* Copie de mots, lignes ou blocs de texte ;
+* Recherche et remplacement de caractères.
-## `vi` command
+## La commande `vi`
-The `vi` command opens the *VI* text editor.
+La commande `vi` ouvre l’éditeur de texte *VI*.
```
-vi [-c command] [file]
+vi [-c commande] [fichier]
```
-Example:
+Exemple :
```
-$ vi /home/rockstar/file
+$ vi /home/rockstar/fichier
```
-| Option | Information |
-| ------------ | ------------------------------------------------- |
-| `-c command` | Execute VI by specifying a command at the opening |
+| Option | Information |
+| ------------- | -------------------------------------------------- |
+| `-c commande` | Exécute VI en précisant une commande à l’ouverture |
-If the file exists at the location mentioned by the path, it is read by VI which is placed in **commands** mode.
+Si le fichier existe à l’endroit mentionné par le chemin, celui-ci est lu par VI qui se place en mode **commandes**.
-If the file does not exist, VI opens a blank file and an empty page is displayed on the screen. When the file is saved, it will take the name specified with the command.
+Si le fichier n’existe pas, VI ouvre un fichier vierge et une page vide est affichée à l’écran. À l’enregistrement du fichier, celui-ci prendra le nom précisé avec la commande.
-If the command `vi` is executed without specifying a file name, VI opens a blank file and an empty page is displayed on the screen. When the file is saved, VI will ask for a file name.
+Si la commande `vi` est exécutée sans préciser de nom de fichier, VI ouvre un fichier vierge et une page vide est affichée à l’écran. À l’enregistrement du fichier, VI demandera un nom de fichier.
-The `vim` editor takes the interface and functions of VI with many improvements.
+L’éditeur `vim` reprend l’interface et les fonctions de VI avec de nombreuses améliorations.
```
-vim [-c command] [file]
+vim [-c commande] [fichier]
```
-Among these improvements, the user has syntax highlighting, which is very useful for editing shell scripts or configuration files.
+Parmi ces améliorations, l’utilisateur dispose de la coloration syntaxique, très utile pour éditer des scripts shell ou des fichiers de configuration.
-During a session, VI uses a buffer file in which it records all the changes made by the user.
+Pendant une session, VI utilise un fichier tampon dans lequel il inscrit toutes les modifications effectuées par l’utilisateur.
-!!! abstract Note As long as the user has not saved his work, the original file is not modified.
+!!! Note Tant que l’utilisateur n’a pas enregistré son travail, le fichier d’origine n’est pas modifié.
-At startup, VI is in *commands* mode.
+Au démarrage, VI est en mode *commandes*.
-!!! abstract Tip A line of text is ended by pressing ENTER but if the screen is not wide enough, VI makes automatic line breaks, _wrap_ configuration by default. These line breaks may not be desired, this is the _nowrap_ configuration.
+!!! Tip Une ligne de texte se termine en appuyant sur ENTREE mais si l’écran n’est pas assez large, VI effectue des retours à la ligne automatiques, configuration _wrap_ par défaut. Ces retours à la ligne peuvent ne pas être souhaités, c’est la configuration _nowrap_.
-To exit VI, from the Commands mode, tap : then type:
+Pour sortir de VI, il faut, depuis le mode Commandes, taper sur : puis saisir :
-* `q` to exit without saving (_quit_);
-* `w` to save your work (_write_);
-* `wq` (_write quit_) or `x` (_eXit_) to save and exit.
+* `q` pour sortir sans sauvegarder (_quit_) ;
+* `w` pour enregistrer son travail (_write_) ;
+* `wq` (_write quit_) ou `x` (_eXit_) pour sortir et sauvegarder.
-To force the exit without confirmation, you must add *!* to the previous commands.
+Pour forcer la sortie sans confirmation, il faut ajouter *!* aux commandes précédentes.
-!!! abstract Warning There is no periodic backup, so you must remember to save your work regularly.
+!!! Warning Il n’y a pas de sauvegarde périodique, il faut donc penser à sauvegarder son travail régulièrement.
-## Operating mode
+## Mode opératoires
-In VI, there are 3 working modes:
+Dans VI, il existe 3 modes de travail :
-* The *command* mode;
-* The *insertion* mode;
-* The *ex* mode.
+* Le mode *commandes* ;
+* Le mode *insertion* ;
+* Le mode *ex*.
-The philosophy of VI is to alternate between the *command* mode and the *insertion* mode.
+La philosophie de VI est d’alterner entre le mode *commandes* et le mode *insertion*.
-The third mode, *ex*, is a footer command mode from an old text editor.
+Le troisième mode, *ex*, est un mode de commandes de bas de page issu d’un ancien éditeur de texte.
-### The Command Mode
+### Le mode Commandes
-This is the default mode when VI starts up. To access it from any of the other modes, simply press the ESC key.
+C’est le mode par défaut au démarrage de VI. Pour y accéder à partir d’un des autres modes, il suffit de taper sur la touche ECHAP.
-All entries are interpreted as commands and the corresponding actions are executed. These are essentially commands for editing text (copy, paste, undo, ...).
+Toutes les saisies sont interprétées comme des commandes et les actions correspondantes sont exécutées. Ce sont essentiellement des commandes permettant la modification de texte (copier, coller, annuler, …).
-The commands are not displayed on the screen.
+Les commandes ne s’affichent pas à l’écran.
-### The Insert mode
+### Le mode Insertion
-This is the text modification mode. To access it from the *command* mode, you have to press special keys that will perform an action in addition to changing the mode.
+C’est le mode de modification du texte. Pour y accéder à partir du mode *commandes*, il faut taper sur des touches particulières qui effectueront une action en plus de changer de mode.
-The text is not entered directly into the file but into a buffer zone in the memory. The changes are only effective when the file is saved.
+La saisie du texte ne s’effectue pas directement sur le fichier mais dans une zone tampon de la mémoire. Les modifications ne sont effectives que lors de l’enregistrement du fichier.
-### The Ex mode
+### Le mode Ex
-This is the file modification mode. To access it, you must first switch to *command* mode, then enter the *ex* command frequently starting with the character `:`.
+C’est le mode de modification du fichier. Pour y accéder, il faut d’abord passer en mode *commandes*, puis saisir la commande *ex* commençant fréquemment par le caractère `:` .
-The command is validated by pressing the ENTER key.
+La commande est validée en appuyant sur la touche ENTREE.
-## Moving the cursor
+## Déplacer le curseur
-In *command* mode, there are several ways to move the cursor.
+En mode *commandes*, il existe plusieurs façons de déplacer le curseur.
-The mouse is not active in a text environment but is in a graphic environment, it is possible to move it character by character, but shortcuts exist to go faster.
+La souris n’étant pas active dans un environnement texte mais l’est dans un environnement graphique, il est possible de le déplacer caractère par caractère, mais des raccourcis existent pour aller plus vite.
-VI remains in *command* mode after moving the cursor.
+VI reste en mode *commandes* après le déplacement du curseur.
-The cursor is placed under the desired character.
+Le curseur est placé sous le caractère désiré.
-### From a character
+### À partir d’un caractère
-* Move one or `n` characters to the left:
+* Déplacement d’un ou `n` caractères vers la gauche :
-←, n←, h or nh
+←, n←, h ou nh
-* Move one or `n` characters to the right:
+* Déplacement d’un ou `n` caractères vers la droite :
-→, n→, l or nl
+→, n→, l ou nl
-* Move one or `n` characters up:
+* Déplacement d’un ou `n` caractères vers le haut :
-↑, n↑, k or nk
+↑, n↑, k ou nk
-* Move one or `n` characters down:
+* Déplacement d’un ou `n` caractères vers le bas :
-↓, n↓, j or nj
+↓, n↓, j ou nj
-* Move to the end of the line:
+* Déplacement à la fin de la ligne :
-$ or END
+$ ou END
-* Move to the beginning of the line:
+* Déplacement au début de la ligne :
-0 or POS1
+0 ou POS1
-### From the first character of a word
+### À partir du premier caractère d’un mot
-Words are made up of letters or numbers. Punctuation characters and apostrophes separate words.
+Les mots sont constitués de lettres ou de chiffres. Les caractères de ponctuation et les apostrophes séparent les mots.
-If the cursor is in the middle of a word w moves to the next word, b moves to the beginning of the word.
+Si le curseur se trouve au milieu d’un mot w passe au mot suivant, b passe au début du mot.
-If the line is finished, VI goes automatically to the next line.
+Si la ligne est finie, VI passe automatiquement à la ligne suivante.
-* Move one or `n` words to the right:
+* Déplacement d’un ou `n` mots vers la droite :
-w or nw
+w ou nw
-* Move one or `n` words to the left:
+* Déplacement d’un ou `n` mots vers la gauche :
-b or nb
+b ou nb
-### From any location on a line
+### À partir de n’importe quel emplacement sur une ligne
-* Move to last line of text:
+* Déplacement à la dernière ligne du texte :
G
-* Move to line `n`:
+* Déplacement à la ligne `n` :
nG
-* Move to the first line of the screen:
+* Déplacement à la première ligne de l’écran :
H
-* Move to the middle line of the screen:
+* Déplacement à la ligne du milieu de l’écran :
M
-* Move to the last line of the screen:
+* Déplacement à la dernière ligne de l’écran :
L
-## Inserting text
+## Insérer du texte
-In *command* mode, there are several ways to insert text.
+En mode *commandes*, il existe plusieurs façons d’insérer du texte.
-VI switches to *insert* mode after entering one of these keys.
+VI bascule en mode *insertion* après la saisie d’une de ces touches.
-!!! abstract Note VI switches to *insertion* mode. So you will have to press the ESC key to return to *command* mode.
+!!! Note VI bascule en mode *insertion*. Il faudra donc appuyer sur la touche ECHAP pour revenir en mode *commandes*.
-### In relation to a character
+### Par rapport à un caractère
-* Inserting text before a character:
+* Insertion de texte avant un caractère :
i (_insert_)
-* Inserting text after a character:
+* Insertion de texte après un caractère :
a (_append_)
-### In relation to a line
+### Par rapport à une ligne
-* Inserting text at the beginning of a line:
+* Insertion de texte au début d’une ligne :
I
-* Inserting text at the end of a line:
+* Insertion de texte à la fin d’une ligne :
A
-### In relation to the text
+### Par rapport au texte
-* Inserting text before a line:
+* Insertion de texte avant une ligne :
O
-* Inserting text after a line:
+* Insertion de texte après une ligne :
o
-## Characters, words and lines
+## Caractères, mots et lignes
-VI allows text editing by managing:
+VI permet l’édition de texte en gérant :
-* characters,
-* words,
-* lines.
+* les caractères,
+* les mots,
+* les lignes.
-In each case it is possible to :
+Il est possible pour chaque cas de :
-* delete,
-* replace,
-* copy,
-* cut,
-* paste.
+* supprimer,
+* remplacer,
+* copier,
+* couper,
+* coller.
-These operations are done in *command* mode.
+Ces opérations se font en mode *commandes*.
-### Characters
+### Caractères
-* Delete one or `n` characters:
+* Supprimer un ou `n` caractères :
-x or nx
+x ou nx
-* Replace a character with another:
+* Remplacer un caractère par un autre :
-rcharacter
+rcaractère
-* Replace more than one character with others:
+* Remplacer plus d’un caractère par d’autres :
-RcharactersESC
+RcaractèresESC
-!!! abstract Note The R command switches to *replace* mode, which is a kind of *insert* mode.
+!!! Note La commande R bascule en mode *remplacement*, qui est une sorte de mode *insertion*.
-### Words
+### Mots
-* Delete (cut) one or `n` words:
+* Supprimer (couper) un ou `n` mots :
-dw or ndw
+dw ou ndw
-* Copy one or `n` words:
+* Copier un ou `n` mots :
-yw or nyw
+yw ou nyw
-* Paste a word once or `n` times after the cursor:
+* Coller un mot une ou `n` fois après le curseur :
-p or np
+p ou np
-* Paste a word once or `n` times before the cursor:
+* Coller un mot une ou `n` fois avant le curseur :
-P or nP
+P ou nP
-* Replace one word:
+* Remplacer un mot :
cw_word_ESC
-!!! abstract Tip It is necessary to position the cursor under the first character of the word to cut (or copy) otherwise VI will cut (or copy) only the part of the word between the cursor and the end. To delete a word is to cut it. If it is not pasted afterwards, the buffer is emptied and the word is deleted.
+!!! Tip Il faut positionner le curseur sous le premier caractère du mot à couper (ou copier) sinon VI coupera (ou copiera) seulement la partie du mot entre le curseur et la fin. Supprimer un mot revient à le couper. S’il n’est pas collé ensuite, le tampon est vidé et le mot est supprimé.
-### Lines
+### Lignes
-* Delete (cut) one or `n` lines:
+* Supprimer (couper) une ou `n` lignes :
-dd or ndd
+dd ou ndd
-* Copy one or `n` lines:
+* Copier une ou `n` lignes :
-yy or nyy
+yy ou nyy
-* Paste what has been copied or deleted once or `n` times after the current line:
+* Coller ce qui a été copié ou supprimé une ou `n` fois après la ligne courante :
-p or np
+p ou np
-* Paste what has been copied or deleted once or `n` times before the current line:
+* Coller ce qui a été copié ou supprimé une ou `n` fois avant la ligne courante :
-P or nP
+P ou nP
-* Delete (cut) from the beginning of the line to the cursor:
+* Supprimer (couper) du début de la ligne jusqu’au curseur :
d0
-* Delete (cut) from the cursor to the end of the line:
+* Supprimer (couper) du curseur jusqu’à la fin de la ligne :
d$
-* Copy from the beginning of the line to the cursor:
+* Copier du début de la ligne jusqu’au curseur :
y0
-* Copy from the cursor to the end of the line:
+* Copier du curseur jusqu’à la fin de la ligne :
y$
-* Delete (cut) the text from the current line:
+* Supprimer (couper) le texte à partir de la ligne courante :
-dL or dG
+dL ou dG
-* Copy the text from the current line:
+* Copier le texte à partir de la ligne courante :
-yL or yG
+yL ou yG
-### Cancel an action
+### Annuler une action
-* Undo the last action:
+* Annuler la dernière action :
u
-* Undo the actions on the current line:
+* Annuler les actions sur la ligne courante :
U
-### Cancel cancellation
+### Annuler l’annulation
-* Cancel a cancellation
+* Annuler une annulation
Ctrl+R
-## EX commands
+## Commandes EX
-The *Ex* mode allows you to act on the file (saving, layout, options, ...). It is also in *Ex* mode where search and replace commands are entered. The commands are displayed at the bottom of the page and must be validated with the ENTER key.
+Le mode *Ex* permet d’agir sur le fichier (enregistrement, mise en page, options, …). C’est aussi en mode *Ex* que se saisissent les commandes de recherche et de remplacement. Les commandes sont affichées en bas de page et doivent être validées avec la touche ENTREE.
-To switch to *Ex* mode, from *command* mode, type :.
+Pour passer en mode *Ex*, du mode *commandes*, taper :.
-### Numbering the lines
+### Numéroter les lignes
-* Show/hide numbering:
+* Afficher/masquer la numérotation :
-`:set nu` and the longer `:set number`
+`:set nu` et sa version longue `:set number`
-`:set nonu` and the longer `:set nonumber`
+`:set nonu` et sa version longue `:set nonumber`
-### Search for a string
+### Rechercher une chaîne de caractères
-* Search for a string from the cursor:
+* Rechercher une chaîne de caractères à partir du curseur :
`/string`
-* Search for a string before the cursor:
+* Rechercher une chaîne de caractères avant le curseur :
`?string`
-* Go to the next occurrence found:
+* Aller à l’occurrence trouvée suivante :
n
-* Go to the previous occurrence found:
+* Aller à l’occurrence trouvée précédente :
N
-There are wildcards to facilitate the search in VI.
+Il existe des caractères jokers permettant de faciliter la recherche sous VI.
-* `[]` : Searches for a range of characters or a single character whose possible values are specified.
+* `[]` : Recherche une plage de caractères ou d’un unique caractère dont les valeurs possibles sont précisées.
-Example:
+Exemple :
-`/[Ww]ord` : search _word_ and _Word_
+`/[Mm]ot` : recherche _mot_ et _Mot_
-`/[1-9]word` : search _1word_, _2word_ … _`x`word_ where `x` is a number
+`/[1-9]mot` : recherche_1mot_, _2mot_ … _`x`mot_ où `x` est un nombre
-* `^` : Search for a string starting the line.
+* `^` : Recherche d’une chaîne débutant la ligne.
-Example:
+Exemple :
-`/^Word`
+`/^Mot`
-* `$` : Search for a string ending the line.
+* `$` : Recherche d’une chaîne finissant la ligne.
-Example:
+Exemple :
-`/Word$`
+`/Mot$`
-* `.` : Search for a word with an unknown letter.
+* `.` : Recherche d’un mot avec une lettre inconnue.
-Example:
+Exemple :
-`/W.rd` : search _Word_, _Ward_ …
+`/M.t` : recherche _Mot_, _Mat_ …
-* `*` : Search for one or more characters, whatever they are.
+* `*` : Recherche d’un ou de plusieurs caractères, quels qu’ils soient.
-Example:
+Exemple :
-`/W*d`
+`/M*t`
-### Replace a string
+### Remplacer une chaîne de caractères
-From the 1st to the last line of the text, replace the searched string by the specified string:
+De la 1ère à la dernière ligne du texte, remplacer la chaîne recherchée par la chaîne précisée :
-`:1,$ s/search/replace`
+`:1,$ s/recherche/remplace`
-**Note:** You can also use `:0,$s/search/replace` to specify starting at the absolute beginning of the file.
+**Note:** Vous pouvez aussi utiliser `:0,$s/recherche/remplace` pour commencer au tout début du fichier.
-From line `n` to line `m`, replace the searched string with the specified string:
+De la ligne `n` à la ligne `m`, remplacer la chaîne recherchée par la chaîne précisée :
-`:n,m s/search/replace`
+`:n,m s/recherche/remplace`
-By default, only the first occurrence found of each line is replaced. To force the replacement of each occurrence, you have to add `/g` at the end of the command:
+Par défaut, seule la première occurrence trouvée de chaque ligne est remplacée. Pour forcer le remplacement de chaque occurrence, il faut ajouter `/g` à la fin de la commande :
-`:n,m s/search/replace/g`
+`:n,m s/recherche/remplace/g`
-Browse an entire file to replace the searched string with the specified string:
+Parcourir tout un fichier pour y remplacer la chaîne recherchée par la chaîne précisée :
-`:% s/search/replace`
+`:% s/recherche/remplace`
-### File operations
+### Opérations sur les fichiers
-* Save the file:
+* Enregistrer le fichier :
`:w`
-* Save under another name:
+* Enregistrer sous un autre nom :
`:w file`
-* Save from line `n` to line `m` in another file:
+* Enregistrer de la ligne `n` à la ligne `m` dans un autre fichier :
`:n,m w file`
-* Reload the last record of the file:
+* Recharger le dernier enregistrement du fichier :
`e!`
-* Paste the content of another file after the cursor:
+* Coller le contenu d’un autre fichier après le curseur :
`:r file`
-* Quit editing a file without saving:
+* Quitter l’édition d’un fichier sans enregistrer :
`:q`
-* Quit editing a file that has been modified during the session but not saved:
+* Quitter l’édition d’un fichier qui a été modifié pendant la session mais sans enregistrer :
`:q!`
-* Exit the file and save:
+* Quitter le fichier et enregistrer :
-`:wq` or `:x`
+`:wq` ou `:x`
-## Other functions
+## Autres fonctions
-It is possible to execute VI by specifying the options to be loaded for the session. To do this, you must use the `-c` option:
+Il est possible d’exécuter VI en précisant les options à charger pour la session. Pour cela, il faut utiliser l’option `-c` :
```
-$ vi -c "set nu" /home/rockstar/file
+$ vi -c "set nu" /home/rockstar/fichier
```
-It is also possible to enter the *Ex* commands in a file named `.exrc` put in the user's login directory. At each VI or VIM startup, the commands will be read and applied.
+Il est aussi possible de saisir les commandes *Ex* dans un fichier nommé `.exrc` mis dans le répertoire de connexion de l’utilisateur. À chaque démarrage de VI ou de VIM, les commandes seront lues et appliquées.
-### `vimtutor` command
+### La commande `vimtutor`
-There is a tutorial for learning how to use VI. It is accessible with the command `vimtutor`.
+Il existe un tutoriel pour apprendre à utiliser VI. Il est accessible avec la commande `vimtutor`.
```
$ vimtutor
diff --git a/docs/books/index.fr.md b/docs/books/index.fr.md
new file mode 100644
index 0000000000..9d71a4c24f
--- /dev/null
+++ b/docs/books/index.fr.md
@@ -0,0 +1,11 @@
+---
+title: Accueil Livres
+author: Steven Spencer
+contributors: '@fromoz'
+---
+
+# Livres d'instruction Rocky Linux
+
+Vous avez trouvé la section **Livres** de la documentation. C'est là que la documentation de forme plus longue est conservée. Ces documents sont répartis en sections ou en chapitres afin de vous faciliter le travail, à votre rythme, et de suivre vos progrès. Ces documents ont été créés par des gens comme vous, avec une passion pour certains sujets.
+
+Voulez-vous vous essayer à écrire un complément à cette section ? C'est SUPER ! Rejoignez simplement la conversation sur le canal [Mattermost Documentation channel](https://chat.rockylinux.org/rocky-linux/channels/documentation) et nous vous aiderons.
diff --git a/docs/books/index.zh.md b/docs/books/index.zh.md
index 40eea82cf0..60d95b2965 100644
--- a/docs/books/index.zh.md
+++ b/docs/books/index.zh.md
@@ -1,11 +1,11 @@
---
title: 书籍首页
author: Steven Spencer
-contributors: tianci li
+contributors: '@fromoz'
---
# Rocky Linux 教学书籍
-您已经找到了文档的 **"books"** (书籍)部分,这是保存较长格式的详细文档的地方。这些文档被拆分为若干部分或"章节",以便您可以按照自己的学习节奏轻松地阅读它们,掌握进度。这些文档是由像您一样对某些主题充满热情的人创建的。
+您已经找到了文档的**"books"** (书籍) 部分, 这是保存较长格式的详细文档的地方。 这些文档被拆分为若干部分或"章节",以便您可以按照自己的学习节奏轻松地阅读它们,掌握进度。 这些文档是由像您一样对某些主题充满热情的人创建的。
-你想试着为这部分写一篇补充文章吗?没问题!只需加入[Mattermost Documentation channel](https://chat.rockylinux.org/rocky-linux/channels/documentation) 对话频道即可,我们将为您提供帮助。
+您想试着为这部分写一篇补充文章吗? 没问题! 只需加入[Mattermost Documentation channel](https://chat.rockylinux.org/rocky-linux/channels/documentation) 对话频道即可,我们将为您提供帮助。
diff --git a/docs/books/learning_ansible/08-management-server-optimizations.it.md b/docs/books/learning_ansible/08-management-server-optimizations.it.md
index ef5a2ecac6..2d0bcaf7c9 100644
--- a/docs/books/learning_ansible/08-management-server-optimizations.it.md
+++ b/docs/books/learning_ansible/08-management-server-optimizations.it.md
@@ -13,13 +13,13 @@ In questo capitolo, esamineremo le opzioni di configurazione che possono essere
Alcune interessanti opzioni di configurazione da commentare:
-* `forks`: per impostazione predefinita a 5, è il numero di processi che Ansible avvierà in parallelo per comunicare con host remoti. Più alto è questo numero, più clienti Ansible sarà in grado di gestire allo stesso tempo, e quindi accelerare l'elaborazione. Il valore che puoi impostare dipende dai limiti CPU/RAM del tuo server di gestione. Nota che il valore predefinito, `5`, è molto piccolo, la documentazione Ansible afferma che molti utenti la impostano a 50, anche 500 o più.
+* `forks`: per impostazione predefinita a 5, è il numero di processi che Ansible avvierà in parallelo per comunicare con gli host remoti. Più alto è questo numero, più clienti Ansible sarà in grado di gestire allo stesso tempo, e quindi accelerare l'elaborazione. Il valore che puoi impostare dipende dai limiti CPU/RAM del tuo server di gestione. Nota che il valore predefinito, `5`, è molto piccolo, la documentazione Ansible afferma che molti utenti la impostano a 50, anche 500 o più.
* `gathering`: questa variabile cambia la politica per la raccolta dei fatti,. Per impostazione predefinita, il valore è `implicit`, il che implica che i fatti saranno raccolti sistematicamente. Il passaggio di questa variabile a `smart` consente di raccogliere i fatti solo quando non sono già stati acquisiti. Accoppiato con una cache di fatti (vedi sotto), questa opzione può aumentare notevolmente le prestazioni.
-* `host_key_check`: Fai attenzione alla sicurezza del tuo server! Tuttavia, se si è in controllo del vostro ambiente, può essere interessante disattivare il controllo della chiave dei server remoti e risparmiare un po 'di tempo alla connessione. È inoltre possibile, su server remoti, disabilitare l'utilizzo del DNS del server SSH (in `/etc/ssh/sshd_config`, opzione `UseDNS no`), questa opzione spreca tempo alla connessione ed è per la maggior parte del tempo, utilizzata solo nei registri di connessione.
+* `host_key_check`: Fai attenzione alla sicurezza del tuo server! Tuttavia, se si è in controllo del vostro ambiente, può essere interessante disattivare il controllo della chiave dei server remoti e risparmiare un po 'di tempo alla connessione. È inoltre possibile, sui server remoti, disabilitare l'utilizzo del DNS del server SSH (in `/etc/ssh/sshd_config`, opzione `UseDNS no`), questa opzione spreca tempo alla connessione ed è per la maggior parte del tempo, utilizzata solo nei registri di connessione.
-* `ansible_managed`: Questa variabile, contenente `Ansible managed` per impostazione predefinita, è tipicamente utilizzata nei modelli di file che vengono distribuiti su server remoti. Consente di specificare ad un amministratore che il file viene gestito automaticamente e che qualsiasi modifica apportata ad esso verrà potenzialmente persa. Può essere interessante lasciare che gli amministratori abbiano dei messaggi più completi. Fai attenzione, però, se cambi questa variabile, potrebbe causare il riavvio dei demoni (tramite i gestori associati ai modelli).
+* `ansible_managed`: Questa variabile, contenente `Ansible managed` per impostazione predefinita, è tipicamente utilizzata nei modelli di file che vengono distribuiti su server remoti. Consente di specificare ad un amministratore che il file viene gestito automaticamente e che qualsiasi modifica apportata ad esso verrà potenzialmente persa. Può essere interessante lasciare che gli amministratori abbiano dei messaggi più completi. Fai attenzione, però, la modifica di questa variabile, potrebbe causare il riavvio dei demoni (tramite i gestori associati ai modelli).
* `ssh_args = -C -o ControlMaster=auto -o ControlPersist=300s -o PreferredAuthentications=publickey`: specifica le opzioni di connessione ssh. Disabilitando tutti i metodi di autenticazione diversi dalla chiave pubblica, puoi risparmiare molto tempo. È inoltre possibile aumentare il `ControlPersist` per migliorare le prestazioni (la documentazione suggerisce che un valore equivalente a 30 minuti può essere appropriato). La connessione a un client rimarrà aperta più a lungo e potrà essere riutilizzata quando ci si riconnette allo stesso server, il che rappresenta un notevole risparmio di tempo.
@@ -29,7 +29,7 @@ Alcune interessanti opzioni di configurazione da commentare:
## Memorizzazione dei fatti
-Raccogliere fatti è un processo che può richiedere un po 'di tempo. Può essere interessante disabilitare questa raccolta per i playbook che non ne hanno bisogno (tramite l'opzione `collect_facts`) o per mantenere questi fatti in memoria in una cache per un certo periodo di tempo (ad esempio 24H).
+Raccogliere fatti è un processo che può richiedere un certo tempo. Può essere interessante disabilitare questa raccolta per i playbook che non ne hanno bisogno (tramite l'opzione `collect_facts`) o per mantenere questi fatti in memoria in una cache per un certo periodo di tempo (ad esempio 24H).
Questi fatti possono essere facilmente memorizzati in un database `redis`:
@@ -62,7 +62,7 @@ Le varie password e segreti non possono essere memorizzate in un testo in chiaro
Ansible propone di utilizzare un gestore di cifratura: `ansible-vault`.
-Il principio è quello di cifrare una variabile o un intero file con il comando `ansible-vault`.
+Il principio è quello di crittografare una variabile o un intero file con il comando `ansible-vault`.
Ansible sarà in grado di decifrare questo file durante l'esecuzione recuperando la chiave di crittografia dal file (ad esempio) `/etc/ansible/ansible.cfg`. Quest'ultimo può anche essere uno script python o altro.
@@ -79,7 +79,7 @@ Memorizza la password in questo file `/etc/ansible/vault_pass` e assegna i dirit
mysecretpassword
```
-È quindi possibile cifrare i file con il comando:
+È quindi possibile crittografare i file con il comando:
```
ansible-vault encrypt myfile.yml
@@ -96,7 +96,7 @@ $ANSIBLE_VAULT;1.1;AES256
6334
```
-Una volta cifrato un file, esso può ancora essere modificato con il comando:
+Una volta cifrato, un file, esso può ancora essere modificato con il comando:
```
ansible-vault edit myfile.yml
diff --git a/docs/books/learning_rsync/01_rsync_overview.it.md b/docs/books/learning_rsync/01_rsync_overview.it.md
new file mode 100644
index 0000000000..dc8539d780
--- /dev/null
+++ b/docs/books/learning_rsync/01_rsync_overview.it.md
@@ -0,0 +1,58 @@
+---
+title: rsync breve descrizione
+author: tianci li
+contributors: Steven Spencer, Franco Colussi
+update: 2021-12-25
+---
+
+# Backup in Sintesi
+
+Che cos'è un backup?
+
+Il backup si riferisce alla duplicazione dei dati nel file system o nel database. In caso di errore o disastro, i dati effettivi del sistema possono essere ripristinati in modo tempestivo per un normale funzionamento.
+
+Quali sono i metodi di backup?
+
+* Backup completo: si riferisce a una copia unica di tutti i file, le cartelle o i dati nel disco rigido o nel database. (Pro: il migliore, può recuperare i dati più velocemente. Svantaggi: occupa più spazio su disco rigido.)
+* Backup incrementale: si riferisce al backup dei dati aggiornati dopo l'ultimo backup completo o incrementale. Il processo è così, un backup completo il primo giorno; un backup dei nuovi dati aggiunti il secondo giorno, anziché un backup completo; il terzo giorno, un backup dei dati appena aggiunti sulla base del secondo giorno. Relativo al giorno successivo. E così via.
+* Backup differenziale: Si riferisce al backup dei file modificati dopo il backup completo. Ad esempio, un backup completo il primo giorno; un backup dei nuovi dati il secondo giorno; un backup dei nuovi dati dal secondo giorno al terzo giorno del terzo giorno; e un backup di tutti i nuovi dati dal secondo giorno al quarto giorno il quarto giorno. E così via.
+* Backup selettivo: Si riferisce al backup di una parte del sistema.
+* Backup a freddo: si riferisce al backup quando il sistema è in stato di arresto o manutenzione. I dati di backup sono esattamente gli stessi dei dati nel sistema durante questo periodo.
+* Hot backup: si riferisce al backup quando il sistema è in funzionamento normale. Poiché i dati nel sistema vengono aggiornati in qualsiasi momento, i dati di backup hanno un certo ritardo rispetto ai dati reali del sistema.
+* Backup remoto: si riferisce al backup dei dati in un'altra posizione geografica per evitare la perdita di dati e l'interruzione del servizio causata da incendi, disastri naturali, furti, ecc.
+
+## rsync in sintesi
+
+Su un server, ho eseguito il backup della prima partizione nella seconda partizione, comunemente nota come "Backup locale." Gli strumenti di backup specifici da poter utilizzare sono `tar` , `dd` , `dump` , `cp`, ecc. Anche se i dati vengono salvati su questo server, se l'hardware non riesce ad avviarsi correttamente, i dati non verranno recuperati. Al fine di risolvere il backup locale Per questo problema, abbiamo introdotto un altro tipo di backup --- "backup remoto".
+
+Alcune persone diranno, non posso usare il comando `tar` o `cp` sul primo server e inviarlo al secondo server tramite `scp` o `sftp`?
+
+In un ambiente di produzione, la quantità di dati è relativamente elevata. Prima di tutto, `tar` o `cp` consuma molto tempo e occupa le prestazioni del sistema. La trasmissione tramite `scp` o `sftp` occupa anche un sacco di larghezza di banda di rete, che non è consentito nell'ambiente di produzione reale. In secondo luogo, questi comandi o strumenti devono essere inseriti manualmente dall'amministratore e devono essere combinati con il crontab dell'attività pianificata. Tuttavia, il tempo impostato da crontab non è facile da cogliere, e non è opportuno eseguire il backup dei dati se il tempo è troppo breve o troppo lungo.
+
+Pertanto, è necessario un backup dei dati nell'ambiente di produzione che deve soddisfare i seguenti requisiti:
+
+1. Backup trasmessi attraverso la rete
+2. Sincronizzazione dei file dati in tempo reale
+3. Meno occupazione delle risorse del sistema e maggiore efficienza
+
+`rsync` sembrava soddisfare le esigenze di cui sopra. Utilizza l'accordo di licenza open source GNU. Si tratta di uno strumento di backup incrementale veloce. L'ultima versione è la 3.2.3 (2020-08-06). Puoi visitare il [Sito ufficiale](https://rsync.samba.org/) per maggiori informazioni.
+
+In termini di supporto alle piattaforme, la maggior parte dei sistemi Unix-like sono supportati, sia che si tratti di GNU/Linux o BSD. Inoltre, ci sono i relativi `rsync` sotto la piattaforma Windows, come cwRsync.
+
+L'originale `rsync` è stato mantenuto dal programmatore australiano Andrew Tridgell (mostrato nella figura 1 qui sotto), ed ora è mantenuto da Wayne Davison (mostrato nella figura 2 qui sotto) Per la manutenzione, puoi andare all'[indirizzo del progetto github ](https://github.com/WayneD/rsync) per ottenere le informazioni che vuoi.
+
+ 
+
+!!! note "Attenzione!" **rsync è solo uno strumento di backup incrementale e non ha la funzione di sincronizzazione dei dati in tempo reale (deve essere integrato da altri programmi). Inoltre, la sincronizzazione è unidirezionale. Se vuoi realizzare la sincronizzazione bidirezionale, devi collaborare con altri strumenti.**
+
+### Principi e funzionalità di base
+
+Come fa `rsync` a realizzare un efficiente backup di sincronizzazione dei dati unidirezionale?
+
+Il core di `rsync` è il suo **algoritmo di Checksum**. Se sei interessato, puoi andare a [Come funziona Rsync](https://rsync. samba. org/how-rsync-works. html) e [L'algoritmo rsync](https://rsync. samba. org/tech_report/) per ulteriori informazioni, Questa sezione è al di là della competenza dell'autore e non sarà trattata troppo.
+
+Le caratteristiche di `rsync` sono:
+
+* L'intera directory può essere aggiornata ricorsivamente;
+* Può mantenere selettivamente gli attributi di sincronizzazione dei file, come hard link, soft link, proprietario, gruppo, autorizzazioni corrispondenti, tempo di modifica, ecc. e può conservare alcuni degli attributi;
+* Supporta due protocolli per la trasmissione, uno è il protocollo ssh, l'altro è il protocollo rsync
diff --git a/docs/books/learning_rsync/01_rsync_overview.zh.md b/docs/books/learning_rsync/01_rsync_overview.zh.md
index 4cb9ac8f8e..3bb5999af6 100644
--- a/docs/books/learning_rsync/01_rsync_overview.zh.md
+++ b/docs/books/learning_rsync/01_rsync_overview.zh.md
@@ -23,13 +23,13 @@ update: 2021-11-04
## rsync简述
-在一台服务器上我将第一个分区备份到第二个分区,也就是俗称的 " 本地备份(Local backup)",备份的具体工具有`tar`、`dd`、`dump`、`cp`等都能实现。 备份的具体工具有`tar`、`dd`、`dump`、`cp`等都能实现。 虽然数据备份在这台服务器上,但如果硬件无法正常启动,数据将不会被检索。 为了解决本地备份这个问题,我们引入了另一种备份——“远程备份”。
+在一台服务器上我将第一个分区备份到第二个分区,也就是俗称的 " 本地备份(Local backup)",备份的具体工具有`tar`、`dd`、`dump`、`cp`等都能实现。 备份的具体工具有 `tar `、 `dd `、 `dump `、 `cp `等都能实现。 虽然数据备份在这台服务器上,但如果硬件无法正常启动,数据将不会被检索。 为了解决本地备份这个问题,我们引入了另一种备份——“远程备份”。
-有人会说,我在第一台服务器上使用tar或者cp命令,然后通过scp或者sftp传到第二台服务器不就可以了吗?
+有人会说,我在第一台服务器上使用 `tar `或者 `cp `命令,然后通过 `scp `或者 `sftp `传到第二台服务器不就可以了吗?
在生产环境下,数据量是比较大的。 首先, `tar` 或者 `cp` 会消耗大量的时间且占用系统的性能。 通过`scp`或者`sftp`传输还会占用大量的网络带宽,这在实际的生产环境下是不被允许的。 其次,这些命令或者说工具是需要管理员手工输入的,需要搭配计划任务crontab一起。 但crontab设定的时间不好掌握,时间太短或者太长对于备份数据来说都是不合适的。
-所以在生产环境下需要有一种数据备份,需满足以下的需求:
+所以在生产环境下需要有一种数据备份,需满足以下的需求:
1. 通过网络传输的备份
2. 实时的数据文件同步
@@ -51,7 +51,7 @@ rsync是如何实现高效的单向数据同步备份的?
Rsync的核心就是它的**Checksum算法**, 如果您感兴趣可以去 [Rsync工作原理](https://rsync.samba.org/how-rsync-works.html) 以及 [rsync算法](https://rsync.samba.org/tech_report/) 了解,这一部分超出了作者的能力范围,不做过多的说明。
-rsync的特点有:
+`rsync`的特点有:
* 能以递归的形式更新整个目录;
* 能有选择的保留文件同步属性,比如硬链接、软链接、所有者、所属组、对应权限、修改时间等,可以保留其中的一部分属性;
diff --git a/docs/books/learning_rsync/02_rsync_demo01.zh.md b/docs/books/learning_rsync/02_rsync_demo01.zh.md
index 9017957dc2..b8eaedc506 100644
--- a/docs/books/learning_rsync/02_rsync_demo01.zh.md
+++ b/docs/books/learning_rsync/02_rsync_demo01.zh.md
@@ -1,150 +1,144 @@
----
-title: rsync 演示01
-author: tianci li
-update: 2021-11-04
----
-
-# 前言
-
-rsync 在进行数据同步之前需要先进行用户身份验证,**有两种协议方式进行身份验证:SSH协议与rsync协议(rsync协议的默认端口为873)**
-
-* SSH协议验证登录方式:使用SSH协议作为基础进行用户身份认证(也就是拿GNU/Linux本身的系统用户和密码做验证),然后进行数据同步。
-* rsync协议验证登录方式:使用rsync协议进行用户身份认证(非GNU/Linux本身的系统用户,类似于vsftpd虚拟用户),然后进行数据同步。
-
-在具体演示rsync同步前,需要说一个命令———`rsync`命令,在Rocky Linux 8中,rsync 的rpm包默认是安装的,版本为3.1.3-12,如下:
-
-```bash
-[root@Rocky ~]# rpm -qa|grep rsync
-rsync-3.1.3-12.el8.x86_64
-```
-
-```txt
-基本格式:rsync [选项] 原始位置 目标位置
-常用的选项:
--a :归档模式,递归且保留文件对象的属性,等同于-rlptgoD(没有-H、-A、-X)
--v :显示同步过程的详细信息
--z :在传输文件时进行压缩
--H :保留硬链接文件
--A :保留ACL权限
--X :保留chattr权限
--r :递归模式,包含目录以及子目录中所有的文件
--l :对于符号链接文件仍然保留
--p :保留文件属性的权限
--t :保留文件属性的时间
--g :保留文件属性的所属组(仅限超级用户使用)
--o :保留文件属性的所有者(仅限超级用户使用)
--D :保留设备文件以及其他特殊文件
-```
-
-作者个人常用:`rsync -avz 原始位置 目标位置`
-
-## 环境说明
-
-|项|说明|
-|---|---|
-| Rocky Linux 8(Server) | 192.168.100.4/24 |
-| Fedora 34(client) | 192.168.100.5/24 |
-
-您可以使用 Fedora 34 进行上传与下载
-
-```mermaid
-graph LR;
-RockyLinux8-->|pull/下载|Fedora34;
-Fedora34-->|push/上传|RockyLinux8;
-```
-
-您也可以使用 Rocky Linux 8 进行上传与下载
-
-```mermaid
-graph LR;
-RockyLinux8-->|push/上传|Fedora34;
-Fedora34-->|pull/下载|RockyLinux8;
-```
-
-## 基于SSH协议的演示
-
-!!! tip "注意!"
- 这里Rocky Linux 8和 Fedora 34都使用 root 用户进行登录。Fedora 34是客户端,Rocky Linux 8是服务器。
-
-### pull/下载
-
-既然是基于SSH协议,我们首先在服务器中创建一个用户:
-
-```bash
-[root@Rocky ~]# useradd testrsync
-[root@Rocky ~]# passwd testrsync
-```
-
-在客户端这边,我们pull/下载过来,服务器的这个文件为/rsync/aabbcc
-
-```bash
-[root@fedora ~]# rsync -avz testrsync@192.168.100.4:/rsync/aabbcc /root
-testrsync@192.168.100.4's password:
-receiving incremental file list
-aabbcc
-
-sent 43 bytes received 85 bytes 51.20 bytes/sec
-total size is 0 speedup is 0.00
-
-[root@fedora ~]# cd
-[root@fedora ~]# ls
-aabbcc
-```
-
-传输成功。
-
-!!! tip "注意"
- 如果服务器的SSH端口不是默认的22,您可以使用类似这样的方式指定端口——`rsync -avz -e 'ssh -p [port]'`。
-
-### push/上传
-
-```bash
-[root@fedora ~]# touch fedora
-[root@fedora ~]# rsync -avz /root/* testrsync@192.168.100.4:/rsync/
-testrsync@192.168.100.4's password:
-sending incremental file list
-anaconda-ks.cfg
-fedora
-rsync: mkstemp "/rsync/.anaconda-ks.cfg.KWf7JF" failed: Permission denied (13)
-rsync: mkstemp "/rsync/.fedora.fL3zPC" failed: Permission denied (13)
-
-sent 760 bytes received 211 bytes 277.43 bytes/sec
-total size is 883 speedup is 0.91
-rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]
-```
-
-**提示权限拒绝,如何处理?**
-
-首先查看 /rsync/ 这个目录的权限。很明显没有w权限,我们可以使用`setfacl`赋予权限
-
-```bash
-[root@Rocky ~]# ls -ld /rsync/
-drwxr-xr-x 2 root root 4096 11月 2 15:05 /rsync/
-```
-
-```bash
-[root@Rocky ~]# setfacl -m u:testrsync:rwx /rsync/
-[root@Rocky ~]# getfacl /rsync/
-getfacl: Removing leading '/' from absolute path names
-# file: rsync/
-# owner: root
-# group: root
-user::rwx
-user:testrsync:rwx
-group::r-x
-mask::rwx
-other::r-x
-```
-
-再次尝试,成功!
-
-```bash
-[root@fedora ~]# rsync -avz /root/* testrsync@192.168.100.4:/rsync/
-testrsync@192.168.100.4's password:
-sending incremental file list
-anaconda-ks.cfg
-fedora
-
-sent 760 bytes received 54 bytes 180.89 bytes/sec
-total size is 883 speedup is 1.08
-```
+---
+title: rsync 演示01
+author: tianci li
+contributors: Steven Spencer
+update: 2021-11-04
+---
+
+# 前言
+
+`rsync` 在进行数据同步之前需要先进行用户身份验证, **有两种协议方式进行身份验证:SSH协议与rsync协议(rsync协议的默认端口为873)**
+
+* SSH协议验证登录方式:使用SSH协议作为基础进行用户身份认证(也就是拿GNU/Linux本身的系统用户和密码做验证),然后进行数据同步。
+* rsync协议验证登录方式:使用rsync协议进行用户身份认证(非GNU/Linux本身的系统用户,类似于vsftpd虚拟用户),然后进行数据同步。
+
+在具体演示rsync同步之前,您需要使用`rsync`命令。 在Rocky Linux 8中,默认安装了rsync rpm软件包,版本为3.1.3-12,如下所示:
+
+```bash
+[root@Rocky ~]# rpm -qa|grep rsync
+rsync-3.1.3-12.el8.x86_64
+```
+
+```txt
+基本格式:rsync [选项] 原始位置 目标位置
+常用的选项:
+-a :归档模式,递归且保留文件对象的属性,等同于-rlptgoD(没有-H、-A、-X)
+-v :显示同步过程的详细信息
+-z :在传输文件时进行压缩
+-H :保留硬链接文件
+-A :保留ACL权限
+-X :保留chattr权限
+-r :递归模式,包含目录以及子目录中所有的文件
+-l :对于符号链接文件仍然保留
+-p :保留文件属性的权限
+-t :保留文件属性的时间
+-g :保留文件属性的所属组(仅限超级用户使用)
+-o :保留文件属性的所有者(仅限超级用户使用)
+-D :保留设备文件以及其他特殊文件
+```
+
+作者个人常用:`rsync -avz 原始位置 目标位置`
+
+## 环境说明
+
+| 项 | 说明 |
+| --------------------- | ---------------- |
+| Rocky Linux 8(Server) | 192.168.100.4/24 |
+| Fedora 34(client) | 192.168.100.5/24 |
+
+您可以使用 Fedora 34 进行上传与下载
+
+```mermaid
+graph LR;
+RockyLinux8-->|pull/下载|Fedora34;
+Fedora34-->|push/上传|RockyLinux8;
+```
+
+您也可以使用 Rocky Linux 8 进行上传与下载
+
+```mermaid
+graph LR;
+RockyLinux8-->|push/上传|Fedora34;
+Fedora34-->|pull/下载|RockyLinux8;
+```
+
+## 基于SSH协议的演示
+
+!!! tip "注意!" 在这里,Rocky Linux 8 和 Fedora 34 都使用root用户登录。 Fedora 34是客户端,Rocky Linux 8是服务器。
+
+### pull/下载
+
+既然是基于SSH协议,我们首先在服务器中创建一个用户:
+
+```bash
+[root@Rocky ~]# useradd testrsync
+[root@Rocky ~]# passwd testrsync
+```
+
+在客户端这边,我们pull/下载过来,服务器的这个文件为/rsync/aabbcc
+
+```bash
+[root@fedora ~]# rsync -avz testrsync@192.168.100.4:/rsync/aabbcc /root
+testrsync@192.168.100.4's password:
+receiving incremental file list
+aabbcc
+sent 43 bytes received 85 bytes 51.20 bytes/sec
+total size is 0 speedup is 0.00
+[root@fedora ~]# cd
+[root@fedora ~]# ls
+aabbcc
+```
+传输成功。
+
+!!! tip "注意" 如果服务器的SSH端口不是默认的22,您可以使用类似这样的方式指定端口——`rsync -avz -e 'ssh -p [port]'`。
+
+### push/上传
+
+```bash
+[root@fedora ~]# touch fedora
+[root@fedora ~]# rsync -avz /root/* testrsync@192.168.100.4:/rsync/
+testrsync@192.168.100.4's password:
+sending incremental file list
+anaconda-ks.cfg
+fedora
+rsync: mkstemp "/rsync/.anaconda-ks.cfg.KWf7JF" failed: Permission denied (13)
+rsync: mkstemp "/rsync/.fedora.fL3zPC" failed: Permission denied (13)
+sent 760 bytes received 211 bytes 277.43 bytes/sec
+total size is 883 speedup is 0.91
+rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]
+```
+
+**提示权限拒绝,如何处理?**
+
+首先查看 /rsync/ 这个目录的权限。 很明显没有w权限, 我们可以使用`setfacl`赋予权限:
+
+```bash
+[root@Rocky ~]# ls -ld /rsync/
+drwxr-xr-x 2 root root 4096 11月 2 15:05 /rsync/
+```
+
+```bash
+[root@Rocky ~]# setfacl -m u:testrsync:rwx /rsync/
+[root@Rocky ~]# getfacl /rsync/
+getfacl: Removing leading '/' from absolute path names
+# file: rsync/
+# owner: root
+# group: root
+user::rwx
+user:testrsync:rwx
+group::r-x
+mask::rwx
+other::r-x
+```
+
+再次尝试,成功!
+
+```bash
+[root@fedora ~]# rsync -avz /root/* testrsync@192.168.100.4:/rsync/
+testrsync@192.168.100.4's password:
+sending incremental file list
+anaconda-ks.cfg
+fedora
+sent 760 bytes received 54 bytes 180.89 bytes/sec
+total size is 883 speedup is 1.08
+```
diff --git a/docs/books/learning_rsync/03_rsync_demo02.zh.md b/docs/books/learning_rsync/03_rsync_demo02.zh.md
index c31a6ee383..be4e4f48ad 100644
--- a/docs/books/learning_rsync/03_rsync_demo02.zh.md
+++ b/docs/books/learning_rsync/03_rsync_demo02.zh.md
@@ -1,137 +1,127 @@
----
-title: rsync 演示02
-author: tianci li
-contributors: Steven Spencer
-update: 2021-11-04
----
-
-# 基于rsync协议的演示
-在vsftpd中,有虚拟用户(管理员自定义的模拟用户),原因在于使用匿名用户和本地用户都不太安全。我们知道基于SSH协议的服务器必须要保证有一个系统的用户,当有许多的同步需求时,就可能需要创建许多的用户,这显然不符合GNU/Linux的运维标准(用户数越多,服务器越不安全),在rsync中,为了安全性考虑,就有了rsync协议验证登录方式。
-
-**具体如何操作?**
-
-在配置文件中写入对应的参数以及值就可以了。在Rocky Linux 8中,需要手动创建 /etc/rsyncd.conf 这个文件。
-
-```bash
-[root@Rocky ~]# touch /etc/rsyncd.conf
-[root@Rocky ~]# vim /etc/rsyncd.conf
-```
-
-该文件的部分参数以及值如下,[这里](04_rsync_configure.zh.md) 有更多的参数说明。
-
-|项|说明|
-|---|---|
-| address = 192.168.100.4 | rsync默认监听的IP地址 |
-| port = 873 | rsync默认监听的端口 |
-| pid file = /var/run/rsyncd.pid | 进程pid的文件位置 |
-| log file = /var/log/rsyncd.log | 日志的文件位置 |
-| [share] | 共享名称 |
-| comment = rsync | 备注或者描述信息 |
-| path = /rsync/ | 所在的系统路径位置 |
-| read only = yes| yes表示只读,no表示可读可写 |
-| dont compress = \*.gz \*.gz2 \*.zip | 哪些文件类型不对它进行压缩 |
-| auth users = li| 启用虚拟用户,定义个虚拟用户叫什么。需要自行创建|
-| secrets file = /etc/rsyncd_users.db | 用来指定虚拟用户的密码文件位置,必须以.db结尾。文件的内容格式是"用户名:密码",一行一个 |
-
-!!! tip "注意!"
- 密码文件的权限必须是600
-
-写入一些文件内容到 /etc/rsyncd.conf,且将用户名与密码写入到 /etc/rsyncd_users.db 中,权限为 600
-
-```bash
-[root@Rocky ~]# cat /etc/rsyncd.conf
-address = 192.168.100.4
-port = 873
-pid file = /var/run/rsyncd.pid
-log file = /var/log/rsyncd.log
-
-[share]
-comment = rsync
-path = /rsync/
-read only = yes
-dont compress = *.gz *.bz2 *.zip
-auth users = li
-secrets file = /etc/rsyncd_users.db
-
-[root@Rocky ~]# ll /etc/rsyncd_users.db
--rw------- 1 root root 9 11月 2 16:16 /etc/rsyncd_users.db
-
-[root@Rocky ~]# cat /etc/rsyncd_users.db
-li:13579
-```
-
-你可能需要`dnf -y install rsync-daemon`,然后才能将服务启动: `systemctl start rsyncd.service`
-
-```bash
-[root@Rocky ~]# systemctl start rsyncd.service
-[root@Rocky ~]# netstat -tulnp
-Active Internet connections (only servers)
-Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
-tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 691/sshd
-tcp 0 0 192.168.100.4:873 0.0.0.0:* LISTEN 4607/rsync
-tcp6 0 0 :::22 :::* LISTEN 691/sshd
-udp 0 0 127.0.0.1:323 0.0.0.0:* 671/chronyd
-udp6 0 0 ::1:323 :::* 671/chronyd
-```
-
-## pull/下载
-
-服务器中创建一个文件进行验证:`[root@Rocky]# touch /rsync/rsynctest.txt`
-
-客户端执行以下操作:
-
-```bash
-[root@fedora ~]# rsync -avz li@192.168.100.4::share /root
-Password:
-receiving incremental file list
-./
-rsynctest.txt
-
-sent 52 bytes received 195 bytes 7.16 bytes/sec
-total size is 883 speedup is 3.57
-
-[root@fedora ~]# ls
-aabbcc anaconda-ks.cfg fedora rsynctest.txt
-```
-
-成功!基于rsync协议除了上面的写法外,您还可以这样写:`rsync://li@10.1.2.84/share`
-
-## push/上传
-
-```bash
-[root@fedora ~]# touch /root/fedora.txt
-[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
-Password:
-sending incremental file list
-rsync: [sender] read error: Connection reset by peer (104)
-rsync error: error in socket IO (code 10) at io.c(784) [sender=3.2.3]
-```
-
-提示您读取错误,和服务器的`read only = yes`有关,更改为`no`,重启服务`[root@Rocky ~]# systemctl restart rsyncd.service`
-
-再次尝试,提示您权限拒绝:
-
-```bash
-[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
-Password:
-sending incremental file list
-fedora.txt
-rsync: mkstemp "/.fedora.txt.hxzBIQ" (in share) failed: Permission denied (13)
-
-sent 206 bytes received 118 bytes 92.57 bytes/sec
-total size is 883 speedup is 2.73
-rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]
-```
-
-我们这里的虚拟用户为 li,它默认映射为 nobody 这个系统用户,当然您可以更改为其他的系统用户。换句话说就是,nobody对 /rsync/ 这个目录没有w权限,当然,我们可以使用`[root@Rocky ~]# setfacl -m u:nobody:rwx /rsync/`,再次尝试,成功。
-
-```bash
-[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
-Password:
-sending incremental file list
-fedora.txt
-
-sent 206 bytes received 35 bytes 96.40 bytes/sec
-total size is 883 speedup is 3.66
-
-```
+---
+title: rsync 演示02
+author: tianci li
+contributors: Steven Spencer
+update: 2021-11-04
+---
+
+# 基于rsync协议的演示
+在vsftpd中,有虚拟用户(管理员自定义的模拟用户),原因在于使用匿名用户和本地用户都不太安全。 我们知道基于SSH协议的服务器必须要保证有一个系统的用户, 当有许多的同步需求时,就可能需要创建许多的用户, 这显然不符合GNU/Linux的运维标准(用户数越多,服务器越不安全),在rsync中,为了安全性考虑,就有了rsync协议验证登录方式。
+
+**具体如何操作?**
+
+在配置文件中写入对应的参数以及值就可以了。 在Rocky Linux 8中,需要手动创建 /etc/rsyncd.conf 这个文件。
+
+```bash
+[root@Rocky ~]# touch /etc/rsyncd.conf
+[root@Rocky ~]# vim /etc/rsyncd.conf
+```
+
+该文件的部分参数以及值如下,[这里](04_rsync_configure.zh.md) 有更多的参数说明。
+
+| 项 | 说明 |
+| ----------------------------------------- | ----------------------------------------------- |
+| address = 192.168.100.4 | rsync默认监听的IP地址 |
+| port = 873 | rsync默认监听的端口 |
+| pid file = /var/run/rsyncd.pid | 进程pid的文件位置 |
+| log file = /var/log/rsyncd.log | 日志的文件位置 |
+| [share] | 共享名称 |
+| comment = rsync | 备注或者描述信息 |
+| path = /rsync/ | 所在的系统路径位置 |
+| read only = yes | yes表示只读,no表示可读可写 |
+| dont compress = \*.gz \*.gz2 \*.zip | 哪些文件类型不对它进行压缩 |
+| auth users = li | 启用虚拟用户,定义个虚拟用户叫什么。 需要自行创建 |
+| secrets file = /etc/rsyncd_users.db | 用来指定虚拟用户的密码文件位置,必须以.db结尾。 文件的内容格式是"用户名:密码",一行一个 |
+
+!!! tip "注意!" 密码文件的权限必须是600
+
+写入一些文件内容到 /etc/rsyncd.conf,且将用户名与密码写入到 /etc/rsyncd_users.db 中,权限为 600
+
+```bash
+[root@Rocky ~]# cat /etc/rsyncd.conf
+address = 192.168.100.4
+port = 873
+pid file = /var/run/rsyncd.pid
+log file = /var/log/rsyncd.log
+[share]
+comment = rsync
+path = /rsync/
+read only = yes
+dont compress = *.gz *.bz2 *.zip
+auth users = li
+secrets file = /etc/rsyncd_users.db
+[root@Rocky ~]# ll /etc/rsyncd_users.db
+-rw------- 1 root root 9 11月 2 16:16 /etc/rsyncd_users.db
+[root@Rocky ~]# cat /etc/rsyncd_users.db
+li:13579
+```
+
+你可能需要`dnf -y install rsync-daemon`,然后才能将服务启动: `systemctl start rsyncd.service`
+
+```bash
+[root@Rocky ~]# systemctl start rsyncd.service
+[root@Rocky ~]# netstat -tulnp
+Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
+tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 691/sshd
+tcp 0 0 192.168.100.4:873 0.0.0.0:* LISTEN 4607/rsync
+tcp6 0 0 :::22 :::* LISTEN 691/sshd
+udp 0 0 127.0.0.1:323 0.0.0.0:* 671/chronyd
+udp6 0 0 ::1:323 :::* 671/chronyd
+```
+
+## pull/下载
+
+服务器中创建一个文件进行验证:`[root@Rocky]# touch /rsync/rsynctest.txt`
+
+客户端执行以下操作:
+
+```bash
+[root@fedora ~]# rsync -avz li@192.168.100.4::share /root
+Password:
+receiving incremental file list
+./
+rsynctest.txt
+sent 52 bytes received 195 bytes 7.16 bytes/sec
+total size is 883 speedup is 3.57
+[root@fedora ~]# ls
+aabbcc anaconda-ks.cfg fedora rsynctest.txt
+```
+
+成功! 基于rsync协议除了上面的写法外,您还可以这样写:`rsync://li@10.1.2.84/share`
+
+## push/上传
+
+```bash
+[root@fedora ~]# touch /root/fedora.txt
+[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
+Password:
+sending incremental file list
+rsync: [sender] read error: Connection reset by peer (104)
+rsync error: error in socket IO (code 10) at io.c(784) [sender=3.2.3]
+```
+
+提示您读取错误,和服务器的`read only = yes`有关。 更改为`no`然后重启服务`[root@Rocky ~]# systemctl restart rsyncd.service`
+
+再次尝试,提示您权限拒绝:
+
+```bash
+[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
+Password:
+sending incremental file list
+fedora.txt
+rsync: mkstemp "/.fedora.txt.hxzBIQ" (in share) failed: Permission denied (13)
+sent 206 bytes received 118 bytes 92.57 bytes/sec
+total size is 883 speedup is 2.73
+rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]
+```
+
+我们这里的虚拟用户为 li,它默认映射为 nobody 这个系统用户, 当然您可以更改为其他的系统用户。 换句话说就是,nobody对 /rsync/ 这个目录没有w权限。 当然,我们可以使用`[root@Rocky ~]# setfacl -m u:nobody:rwx /rsync/`,再次尝试,成功。
+
+```bash
+[root@fedora ~]# rsync -avz /root/* li@192.168.100.4::share
+Password:
+sending incremental file list
+fedora.txt
+sent 206 bytes received 35 bytes 96.40 bytes/sec
+total size is 883 speedup is 3.66
+```
diff --git a/docs/books/learning_rsync/04_rsync_configure.zh.md b/docs/books/learning_rsync/04_rsync_configure.zh.md
index 8cd7f10236..5a86322eb9 100644
--- a/docs/books/learning_rsync/04_rsync_configure.zh.md
+++ b/docs/books/learning_rsync/04_rsync_configure.zh.md
@@ -1,31 +1,31 @@
----
-title: rsync 配置文件
-author: tianci li
-update: 2021-11-04
----
-
-# /etc/rsyncd.conf
-
-上一篇 [rsync演示02](03_rsync_demo02.zh.md) 我们介绍了一些基本的参数,本篇是做另外参数的补充。
-
-|参数|说明|
-|---|---|
-| fake super = yes | yes表示不需要daemon以root运行,就可以存储文件的完整属性。|
-| uid = | |
-| gid = | 两个参数用来指定当以root身份运行rsync守护进程时,指定传输文件所使用的用户和组,默认都是nobody |
-| use chroot = yes | 传输前是否需要进行根目录的锁定,yes是,no否。rsync为了增加安全性,默认值为yes。|
-| max connections = 4 | 允许最大的连接数,默认值为0,表示不做限制|
-| lock file = /var/run/rsyncd.lock | 指定的锁文件,和“max connections ”参数关联|
-| exclude = lost+found/ |排除不需要传输的目录|
-| transfer logging = yes | 是否启用类似ftp的日志格式来记录rsync的上传和下载|
-| timeout = 900 | 指定超时的时间,如果在指定时间内没有数据被传输,则rsync将直接退出。单位为秒,默认值为0表示永不超时|
-| ignore nonreadable = yes |是否忽略用户没有访问权限的文件|
-| motd file = /etc/rsyncd/rsyncd.motd | 用来指定消息文件的路径,默认是没有motd文件的。这个消息就是当用户登录以后显示的欢迎信息。|
-| hosts allow = 10.1.1.1/24 | 用于指定哪些IP或者网段的客户端允许访问。可填写ip、网段、主机名、域下面的主机,多个用空格隔开。默认允许所有人访问|
-| hosts deny = 10.1.1.20 | 用户指定哪些ip或者网段的客户端不允许访问。如果hosts allow和hosts deny有相同的匹配结果,则该客户端最终不能访问。如果客户端的地址即不在hosts allow中,也不在hosts deny中,则该客户端允许访问。默认情况下,没有该参数|
-| auth users = li |启用虚拟用户,多个用户用英语状态的逗号进行隔开|
-| syslog facility = daemon | 定义系统日志的级别,有这些值可填:auth、authpriv、cron、daemon、ftp、kern、lpr、mail、news、 security、syslog、user、uucp、 local0、local1、local2、local3、local4、local5、local6和local7。默认值是daemon|
-
-## 推荐的配置
-
-
\ No newline at end of file
+---
+title: rsync 配置文件
+author: tianci li
+update: 2021-11-04
+---
+
+# /etc/rsyncd.conf
+
+上一篇 [rsync演示02](03_rsync_demo02.zh.md) 我们介绍了一些基本的参数,本篇是做另外参数的补充。 本篇是做另外参数的补充。
+
+| 参数 | 说明 |
+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| fake super = yes | yes表示不需要daemon以root运行,就可以存储文件的完整属性。 |
+| uid = | |
+| gid = | 两个参数用来指定当以root身份运行rsync守护进程时,指定传输文件所使用的用户和组,默认都是nobody 默认是nobody |
+| use chroot = yes | 传输前是否需要进行根目录的锁定,yes是,no否。 rsync为了增加安全性,默认值为yes。 |
+| max connections = 4 | 允许最大的连接数,默认值为0,表示不做限制 |
+| lock file = /var/run/rsyncd.lock | 指定的锁文件,和“max connections ”参数关联 |
+| exclude = lost+found/ | 排除不需要传输的目录 |
+| transfer logging = yes | 是否启用类似ftp的日志格式来记录rsync的上传和下载 |
+| timeout = 900 | 指定超时时间。 指定超时的时间,如果在指定时间内没有数据被传输,则rsync将直接退出。 单位为秒,默认值为0表示永不超时 |
+| ignore nonreadable = yes | 是否忽略用户没有访问权限的文件 |
+| motd file = /etc/rsyncd/rsyncd.motd | 用于指定消息文件的路径。 默认情况下,是没有 motd 文件的。 这个消息就是当用户登录以后显示的欢迎信息。 |
+| hosts allow = 10.1.1.1/24 | 用于指定哪些IP或者网段的客户端允许访问。 可填写ip、网段、主机名、域下面的主机,多个用空格隔开。 默认允许所有人访问 |
+| hosts deny = 10.1.1.20 | 用户指定哪些ip或者网段的客户端不允许访问。 如果hosts allow和hosts deny有相同的匹配结果,则该客户端最终不能访问。 如果客户端的地址即不在hosts allow中,也不在hosts deny中,则该客户端允许访问。 默认情况下,没有该参数 |
+| auth users = li | 启用虚拟用户,多个用户用英语状态的逗号进行隔开 |
+| syslog facility = daemon | 定义系统日志的级别, 有这些值可填:auth、authpriv、cron、daemon、ftp、kern、lpr、mail、news、 security、syslog、user、uucp、 local0、local1、local2、local3、local4、local5、local6和local7。 默认值是daemon |
+
+## 推荐的配置
+
+
diff --git a/docs/books/learning_rsync/05_rsync_authentication-free_login.zh.md b/docs/books/learning_rsync/05_rsync_authentication-free_login.zh.md
index f6415a1748..0d2cba4246 100644
--- a/docs/books/learning_rsync/05_rsync_authentication-free_login.zh.md
+++ b/docs/books/learning_rsync/05_rsync_authentication-free_login.zh.md
@@ -1,97 +1,96 @@
----
-title: rsync 免密验证登录
-author: tianci li
-update: 2021-11-04
----
-
-# 前言
-
-由 [rsync 简述](01_rsync_overview.zh.md) 我们知道,rsync是一个增量同步的工具,每执行一次`rsync`命令,就能实现一次数据的同步,但并不能实时的同步数据,那怎么办呢?
-
-搭配inotify-tools这个程序工具,可以实现单向的实时同步。既然是实时的数据同步,前提条件是需要免密验证登录。
-
-**不管是rsync协议,还是SSH协议,两者都能实现免密验证登录。**
-
-## SSH协议的免密验证登录
-
-首先在客户端生成公钥私钥对,键入命令后一直回车即可。密钥对保存在 /root/.ssh/ 目录中
-
-```bash
-[root@fedora ~]# ssh-keygen -t rsa -b 2048
-Generating public/private rsa key pair.
-Enter file in which to save the key (/root/.ssh/id_rsa):
-Enter passphrase (empty for no passphrase):
-Enter same passphrase again:
-Your identification has been saved in /root/.ssh/id_rsa
-Your public key has been saved in /root/.ssh/id_rsa.pub
-The key fingerprint is:
-SHA256:TDA3tWeRhQIqzTORLaqy18nKnQOFNDhoAsNqRLo1TMg root@fedora
-The key's randomart image is:
-+---[RSA 2048]----+
-|O+. +o+o. .+. |
-|BEo oo*....o. |
-|*o+o..*.. ..o |
-|.+..o. = o |
-|o o S |
-|. o |
-| o + . |
-|....=. |
-| .o.o. |
-+----[SHA256]-----+
-```
-
-然后,使用`scp`命令将公钥文件上传给服务器。比如我将这个公钥上传给 **testrsync** 这个用户
-
-```bash
-[root@fedora ~]# scp -P 22 /root/.ssh/id_rsa.pub root@192.168.100.4:/home/testrsync/
-```
-
-```bash
-[root@Rocky ~]# cat /home/testrsync/id_rsa.pub >> /home/testrsync/.ssh/authorized_keys
-```
-
-尝试下免密验证登录,成功!
-
-```bash
-[root@fedora ~]# ssh -p 22 testrsync@192.168.100.4
-Last login: Tue Nov 2 21:42:44 2021 from 192.168.100.5
-[testrsync@Rocky ~]$
-```
-
-!!! tip "注意!"
- 服务器的配置文件 **/etc/ssh/sshd_config** 应该打开 PubkeyAuthentication yes
-
-## rsync协议免密验证登录
-
-在客户端,rsync 服务为系统准备了一个环境变量——**RSYNC_PASSWORD**,默认是空值,如下所示:
-
-```bash
-[root@fedora ~]# echo "$RSYNC_PASSWORD"
-
-[root@fedora ~]#
-```
-
-如果要实现免密验证登录,只需要给这个变量赋值就可以了。所赋的值就是之前给虚拟用户 li 设置的密码。同时将这个变量申明为全局变量。
-
-```bash
-[root@Rocky ~]# cat /etc/rsyncd_users.db
-li:13579
-```
-
-```bash
-[root@fedora ~]# export RSYNC_PASSWORD=13579
-```
-
-尝试下,成功!这里没有新文件出现,所以传输的文件列表并没有显示出来。
-
-```bash
-[root@fedora ~]# rsync -avz li@192.168.100.4::share /root/
-receiving incremental file list
-./
-
-sent 30 bytes received 193 bytes 148.67 bytes/sec
-total size is 883 speedup is 3.96
-```
-
-!!! tip "提示!"
- 您可以将这个变量写入到 **/etc/profile** 当中,让其永久生效。内容为:`export RSYNC_PASSWORD=13579`
\ No newline at end of file
+---
+title: rsync 免密验证登录
+author: tianci li
+contributors: Steven Spencer
+update: 2021-11-04
+---
+
+# 前言
+
+由 [rsync 简述](01_rsync_overview.zh.md) 我们知道,rsync是一个增量同步的工具, 每执行一次`rsync`命令,就能实现一次数据的同步,但并不能实时的同步数据。 那怎么办呢?
+
+搭配inotify-tools这个程序工具,可以实现单向的实时同步。 既然是实时的数据同步,前提条件是需要免密验证登录。
+
+**不管是rsync协议,还是SSH协议,两者都能实现免密验证登录。**
+
+## SSH协议的免密验证登录
+
+首先在客户端生成公钥私钥对,键入命令后一直回车即可。 密钥对保存在 /root/.ssh/ 目录中
+
+```bash
+[root@fedora ~]# ssh-keygen -t rsa -b 2048
+Generating public/private rsa key pair.
+Enter file in which to save the key (/root/.ssh/id_rsa):
+Enter passphrase (empty for no passphrase):
+Enter same passphrase again:
+Your identification has been saved in /root/.ssh/id_rsa
+Your public key has been saved in /root/.ssh/id_rsa.pub
+The key fingerprint is:
+SHA256: TDA3tWeRhQIqzTORLaqy18nKnQOFNDhoAsNqRLo1TMg root@fedora
+The key's randomart image is:
++---[RSA 2048]----+
+|O+. +o+o. .+. |
+|BEo oo*....o. |
+|*o+o..*.. ..o |
+|.+..o. = o |
+|o o S |
+|. o |
+| o +. |
+|....=. |
+| .o.o. |
++----[SHA256]-----+
+```
+
+然后,使用`scp`命令将公钥文件上传给服务器。 比如我将这个公钥上传给 **testrsync** 这个用户
+
+```bash
+[root@fedora ~]# scp -P 22 /root/.ssh/id_rsa.pub root@192.168.100.4:/home/testrsync/
+```
+
+```bash
+[root@Rocky ~]# cat /home/testrsync/id_rsa.pub >> /home/testrsync/.ssh/authorized_keys
+```
+
+尝试下免密验证登录,成功!
+
+```bash
+[root@fedora ~]# ssh -p 22 testrsync@192.168.100.4
+Last login: Tue Nov 2 21:42:44 2021 from 192.168.100.5
+[testrsync@Rocky ~]$
+```
+
+!!! tip "注意!" !!! tip "注意!" 服务器的配置文件 **/etc/ssh/sshd_config** 应该打开 PubkeyAuthentication yes
+
+## rsync协议免密验证登录
+
+在客户端,rsync 服务为系统准备了一个环境变量——**RSYNC_PASSWORD**,默认是空值,如下所示:
+
+```bash
+[root@fedora ~]# echo "$RSYNC_PASSWORD"
+
+[root@fedora ~]#
+```
+
+如果要实现免密验证登录,只需要给这个变量赋值就可以了。 所赋的值就是之前给虚拟用户 li 设置的密码。 同时将这个变量申明为全局变量。
+
+```bash
+[root@Rocky ~]# cat /etc/rsyncd_users.db
+li:13579
+```
+
+```bash
+[root@fedora ~]# export RSYNC_PASSWORD=13579
+```
+
+尝试下,成功! 这里没有新文件出现,所以传输的文件列表并没有显示出来。
+
+```bash
+[root@fedora ~]# rsync -avz li@192.168.100.4::share /root/
+receiving incremental file list
+./
+
+sent 30 bytes received 193 bytes 148.67 bytes/sec
+total size is 883 speedup is 3.96
+```
+
+!!! tip "提示!" !!! tip "提示!" 您可以将这个变量写入到 **/etc/profile** 当中,让其永久生效。 内容为:`export RSYNC_PASSWORD=13579`
diff --git a/docs/books/learning_rsync/06_rsync_inotify.zh.md b/docs/books/learning_rsync/06_rsync_inotify.zh.md
index 74db27ee5e..1541eb00ca 100644
--- a/docs/books/learning_rsync/06_rsync_inotify.zh.md
+++ b/docs/books/learning_rsync/06_rsync_inotify.zh.md
@@ -1,152 +1,149 @@
----
-title: inotify-tools 安装与使用
-author: tianci li
-update: 2021-11-04
----
-
-# 编译安装
-
-在服务器中执行以下操作,在你的环境中,可能会缺少一些依赖的包,安装上——`dnf -y install autoconf automake libtool`
-
-```bash
-[root@Rocky ~]# wget -c https://github.com/inotify-tools/inotify-tools/archive/refs/tags/3.21.9.6.tar.gz
-[root@Rocky ~]# tar -zvxf 3.21.9.6.tar.gz -C /usr/local/src/
-[root@Rocky ~]# cd /usr/local/src/inotify-tools-3.21.9.6/
-[root@Rocky /usr/local/src/inotify-tools-3.21.9.6]# ./autogen.sh && \
-./configure --prefix=/usr/local/inotify-tools && \
-make && \
-make install
-...
-[root@Rocky ~]# ls /usr/local/inotify-tools/bin/
-inotifywait inotifywatch
-```
-
-对环境变量PATH进行追加,写入到配置文件中且让其永久生效。
-
-```bash
-[root@Rocky ~]# vim /etc/profile
-...
-PATH=$PATH:/usr/local/inotify-tools/bin/
-[root@Rocky ~]# . /etc/profile
-```
-
-**为什么不使用EPEL存储库的inotify-tools RPM包?而使用源代码编译安装的方式?**
-
-作者个人认为,远程传输数据关乎效率问题,特别在在生产环境下,要同步的文件数量多且单文件特别大的前提下,这特别重要。而且新版本会有一些bug修复与功能拓展,也许新版本的传输效率会更加高,所以我更加推荐用源代码的方式安装 inotify-tools 。当然,这是作者的个人建议,不是每个用户都必须遵循的。
-
-## 内核参数调整
-
-您可以根据生产环境的需要,对内核参数进行调整。默认情况下,在 **/proc/sys/fs/inotity/** 有三个文件
-
-```bash
-[root@Rocky ~]# cd /proc/sys/fs/inotify/
-[root@Rocky /proc/sys/fs/inotify]# cat max_queued_events ;cat max_user_instances ;cat max_user_watches
-16384
-128
-28014
-```
-* max_queued_events - 最多监控队列大小,默认16384
-* max_user_instances - 最多监控实例数,默认128
-* max_user_watches - 每个实例最多监控的文件数,默认8192
-
-写入一些参数与值到 **/etc/sysctl.conf** 当中,示例如下。然后使用`sysctl -p`让文件它们生效
-
-```txt
-fs.inotify.max_queued_events = 16384
-fs.inotify.max_user_instances = 1024
-fs.inotify.max_user_watches = 1048576
-```
-
-## 相关命令
-
-inotify-tools工具有两个命令,分别是:
-* **inotifywait** - 用于持续监控,实时输出结果。一般是配合rsync增量备份工具一起使用,因为是文件系统的监控,所以可以搭配脚本一起使用,后面我们会介绍具体的脚本写法。
-* **inotifywatch** - 用于短期监控,任务完成后输出结果。
-
-inotifywait 主要有以下选项:
-
-```txt
--m 表示持续监控
--r 递归监控
--q 简化输出信息
--e 指定监控数据的事件类型,多个事件类型用英文状态的逗号隔开
-```
-
-事件有这些,如下:
-
-| 事件类型 | 说明 |
-|---|---|
-| access | 文件或目录的内容进行访问 |
-| modify | 文件或目录的内容被写入|
-| attrib | 文件或目录的属性被修改 |
-| close_write | 文件或目录在可写模式下打开后关闭 |
-| close_nowrite | 文件或目录在以只读模式打开后关闭 |
-| close | 无论读/写模式,文件或目录关闭 |
-| open | 文件或者目录被打开 |
-| moved_to | 有文件或目录移动到监控的目录中 |
-| moved_from | 有文件或目录从监控的目录中移出 |
-| move | 有文件或者目录,被移动到监控目录或者从监控目录中移出 |
-| move_self | 已移动受监视的文件或目录 |
-| create | 被监控的目录内有创建的文件或目录 |
-| delete | 被监控的目录内有文件或目录被删除 |
-| delete_self | 文件或目录以及删除 |
-| unmount | 包含已卸载文件或目录的文件系统 |
-
-示例:`[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/`
-
-## inotifywait命令的演示
-
-在第一个终端pts/0中键入命令,回车后窗口被锁定,表示正在监控
-
-```bash
-[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/
-
-```
-
-在第二个终端pts/1中,进入到 /rsync/ 目录中,创建文件。
-
-```bash
-[root@Rocky ~]# cd /rsync/
-[root@Rocky /rsync]# touch inotify
-```
-
-回到第一个终端pts/0中,输出信息如下:
-
-```bash
-[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/
-/rsync/ CREATE inotify
-
-```
-
-## inotifywait和rsync的结合使用
-
-!!! tip "注意!"
- 我们在Rocky Linux 8服务器中进行操作,使用SSH协议进行演示。
-
-SSH协议的免密验证登录,可参考 [rsync 免密验证登录](05_rsync_authentication-free_login.zh.md),这里不具体说明。bash脚本内容示例如下,您可以根据需要,在命令的后面加上不同的选项来满足需求,例如还可以在`rsync`命令后面加入`--delete`
-
-```bash
-#!/bin/bash
-a="/usr/local/inotify-tools/bin/inotifywait -mrq -e modify,move,create,delete /rsync/"
-b="/usr/bin/rsync -avz /rsync/* testfedora@192.168.100.5:/home/testfedora/"
-$a | while read directory event file
- do
- $b &>> /tmp/rsync.log
- done
-```
-
-```bash
-[root@Rocky ~]# chmod +x rsync_inotify.sh
-[root@Rocky ~]# bash /root/rsync_inotify.sh &
-```
-
-!!! tip "再次强调!"
- 使用SSH协议进行数据同步传输时,如果目标机器的SSH服务端口不是22 ,则您可以使用类似这样的方式——
- `b="/usr/bin/rsync -avz -e 'ssh -p [port-number]' /rsync/* testfedora@192.168.100.5:/home/testfedora/"`
-
-!!! tip "注意!"
- 如果您要开机自启动这个脚本的话
- `[root@Rocky ~]# echo "bash /root/rsync_inotify.sh &" >> /etc/rc.local`
- `[root@Rocky ~]# chmod +x /etc/rc.local`
-
-如果您使用的是rsync协议进行同步,您需要配置目标机器的rsync服务,可参考[rsync 演示02](03_rsync_demo02.zh.md)、[rsync 配置文件](04_rsync_configure.zh.md)、[rsync 免密验证登录](05_rsync_authentication-free_login.zh.md)
+---
+title: inotify-tools 安装与使用
+author: tianci li
+contributors: Steven Spencer
+update: 2021-11-04
+---
+
+# 编译安装
+
+在服务器中执行以下操作, 在你的环境中,可能会缺少一些依赖的包, 在服务器中执行以下操作,在你的环境中,可能会缺少一些依赖的包,安装上——`dnf -y install autoconf automake libtool`
+
+```bash
+[root@Rocky ~]# wget -c https://github.com/inotify-tools/inotify-tools/archive/refs/tags/3.21.9.6.tar.gz
+[root@Rocky ~]# tar -zvxf 3.21.9.6.tar.gz -C /usr/local/src/
+[root@Rocky ~]# cd /usr/local/src/inotify-tools-3.21.9.6/
+[root@Rocky /usr/local/src/inotify-tools-3.21.9.6]# ./autogen.sh && \
+./configure --prefix=/usr/local/inotify-tools && \
+make && \
+make install
+...
+[root@Rocky ~]# ls /usr/local/inotify-tools/bin/
+inotifywait inotifywatch
+[root@Rocky ~]# ls /usr/local/inotify-tools/bin/
+inotifywait inotifywatch
+```
+
+对环境变量PATH进行追加,写入到配置文件中且让其永久生效。
+
+```bash
+[root@Rocky ~]# vim /etc/profile
+...
+PATH=$PATH:/usr/local/inotify-tools/bin/
+[root@Rocky ~]# . /etc/profile
+```
+
+**为什么不使用EPEL存储库的inotify-tools RPM包? 而使用源代码编译安装的方式?**
+
+作者个人认为,远程传输数据关乎效率问题,特别在在生产环境下,要同步的文件数量多且单文件特别大的前提下,这特别重要。 而且新版本会有一些bug修复与功能拓展,也许新版本的传输效率会更加高,所以我更加推荐用源代码的方式安装 inotify-tools 。 当然,这是作者的个人建议,不是每个用户都必须遵循的。
+
+## 内核参数调整
+
+您可以根据生产环境的需要,对内核参数进行调整。 默认情况下,在 **/proc/sys/fs/inotity/** 有三个文件
+
+```bash
+[root@Rocky ~]# cd /proc/sys/fs/inotify/
+[root@Rocky /proc/sys/fs/inotify]# cat max_queued_events ;cat max_user_instances ;cat max_user_watches
+16384
+128
+28014
+```
+
+* max_queued_events - 最多监控队列大小,默认16384
+* max_user_instances - 最多监控实例数,默认128
+* max_user_watches - 每个实例最多监控的文件数,默认8192
+
+写入一些参数与值到 **/etc/sysctl.conf** 当中,示例如下。 然后使用`sysctl -p`让文件它们生效
+
+```txt
+fs.inotify.max_queued_events = 16384
+fs.inotify.max_user_instances = 1024
+fs.inotify.max_user_watches = 1048576
+```
+
+## 相关命令
+
+inotify-tools工具有两个命令,分别是:
+* **inotifywait** - 用于持续监控,实时输出结果。 一般是配合rsync增量备份工具一起使用,因为是文件系统的监控,所以可以搭配脚本一起使用,后面我们会介绍具体的脚本写法。 因为是文件系统的监控,所以可以搭配脚本一起使用。 后面我们会介绍具体的脚本写法。
+* **inotifywatch** - 用于短期监控,任务完成后输出结果。
+
+inotifywait 主要有以下选项:
+
+```txt
+-m 表示持续监控
+-r 递归监控
+-q 简化输出信息
+-e 指定监控数据的事件类型,多个事件类型用英文状态的逗号隔开
+```
+
+事件有这些,如下:
+
+| 事件类型 | 说明 |
+| ------------- | -------------------------- |
+| access | 文件或目录的内容进行访问 |
+| modify | 文件或目录的内容被写入 |
+| attrib | 文件或目录的属性被修改 |
+| close_write | 文件或目录在可写模式下打开后关闭 |
+| close_nowrite | 文件或目录在以只读模式打开后关闭 |
+| close | 无论读/写模式,文件或目录关闭 |
+| open | 文件或者目录被打开 |
+| moved_to | 有文件或目录移动到监控的目录中 |
+| moved_from | 有文件或目录从监控的目录中移出 |
+| move | 有文件或者目录,被移动到监控目录或者从监控目录中移出 |
+| move_self | 已移动受监视的文件或目录 |
+| create | 被监控的目录内有创建的文件或目录 |
+| delete | 被监控的目录内有文件或目录被删除 |
+| delete_self | 文件或目录以及删除 |
+| unmount | 包含已卸载文件或目录的文件系统 |
+
+示例:`[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/`
+
+## inotifywait命令的演示
+
+在第一个终端pts/0中键入命令,回车后窗口被锁定,表示正在监控
+
+```bash
+[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/
+
+```
+
+在第二个终端pts/1中,进入到 /rsync/ 目录中,创建文件。
+
+```bash
+[root@Rocky ~]# cd /rsync/
+[root@Rocky /rsync]# touch inotify
+```
+
+回到第一个终端pts/0中,输出信息如下:
+
+```bash
+[root@Rocky ~]# inotifywait -mrq -e create,delete /rsync/
+/rsync/ CREATE inotify
+```
+
+## inotifywait和rsync的结合使用
+
+!!! tip "注意!" 我们在Rocky Linux 8服务器上操作,使用SSH协议进行演示。
+
+SSH协议的免密验证登录,可参考 [rsync 免密验证登录](05_rsync_authentication-free_login.zh.md),这里不具体说明。 bash脚本内容示例如下。 您可以根据需要,在命令的后面加上不同的选项来满足需求。 bash脚本内容示例如下,您可以根据需要,在命令的后面加上不同的选项来满足需求,例如还可以在`rsync`命令后面加入`--delete`
+
+```bash
+#!/bin/bash
+a="/usr/local/inotify-tools/bin/inotifywait -mrq -e modify,move,create,delete /rsync/"
+b="/usr/bin/rsync -avz /rsync/* testfedora@192.168.100.5:/home/testfedora/"
+$a | while read directory event file
+ do
+ $b &>> /tmp/rsync.log
+ done
+```
+
+```bash
+[root@Rocky ~]# chmod +x rsync_inotify.sh
+[root@Rocky ~]# bash /root/rsync_inotify.sh &
+```
+
+!!! tip "再次强调!" !!! tip "再次强调!" 使用SSH协议进行数据同步传输时,如果目标机器的SSH服务端口不是22 ,则您可以使用类似这样的方式—— `b="/usr/bin/rsync -avz -e 'ssh -p [port-number]' /rsync/* testfedora@192.168.100.5:/home/testfedora/"`
+
+!!! tip "注意!" 如果您要开机自启动这个脚本的话 `[root@Rocky ~]# echo "bash /root/rsync_inotify.sh &" >> /etc/rc.local` `[root@Rocky ~]# chmod +x /etc/rc.local`
+
+如果您使用的是rsync协议进行同步,您需要配置目标机器的rsync服务,可参考[rsync 演示02](03_rsync_demo02.zh.md)、[rsync 配置文件](04_rsync_configure.zh.md)、[rsync 免密验证登录](05_rsync_authentication-free_login.zh.md)
diff --git a/docs/books/learning_rsync/07_rsync_unison_use.zh.md b/docs/books/learning_rsync/07_rsync_unison_use.zh.md
index d0150d859a..530b403131 100644
--- a/docs/books/learning_rsync/07_rsync_unison_use.zh.md
+++ b/docs/books/learning_rsync/07_rsync_unison_use.zh.md
@@ -1,142 +1,148 @@
----
-title: 使用 unison
-author: tianci li
-update: 2021-11-06
----
-
-# 简述
-
-前面我们提到,单向同步使用的是rsync + inotify-tools。在一些比较特殊的使用场景下可能需要双向同步,这就需要inotify-tools + unison。
-
-## 环境准备
-
-* Rocky Linux 8 与 Fedora 34 都需要源代码编译安装 **inotify-tools** ,这里不具体展开。
-* 两台机器都必须免密登录验证,这里我们使用的是SSH协议进行
-* [ocaml](https://github.com/ocaml/ocaml/) 使用v4.12.0,[unison](https://github.com/bcpierce00/unison/) 使用v2.51.4。
-
-环境准备好后,可以进行验证:
-
-```bash
-[root@Rocky ~]# inotifywa
-inotifywait inotifywatch
-[root@Rocky ~]# ssh -p 22 testrsync@192.168.100.5
-Last login: Thu Nov 4 13:13:42 2021 from 192.168.100.4
-[testrsync@fedora ~]$
-```
-
-```bash
-[root@fedora ~]# inotifywa
-inotifywait inotifywatch
-[root@fedora ~]# ssh -p 22 testrsync@192.168.100.4
-Last login: Wed Nov 3 22:07:18 2021 from 192.168.100.5
-[testrsync@Rocky ~]$
-```
-
-!!! tip "注意"
- 两台机器的配置文件 **/etc/ssh/sshd_config** 应该打开 PubkeyAuthentication yes
-
-## Rocky Linux 8 安装unison
-
-ocaml是一门编程语言,unison的底层依赖它。
-
-```bash
-[root@Rocky ~]# wget -c https://github.com/ocaml/ocaml/archive/refs/tags/4.12.0.tar.gz
-[root@Rocky ~]# tar -zvxf 4.12.0.tar.gz -C /usr/local/src/
-[root@Rocky ~]# cd /usr/local/src/ocaml-4.12.0
-[root@Rocky /usr/local/src/ocaml-4.12.0]# ./configure --prefix=/usr/local/ocaml && make world opt && make install
-...
-[root@Rocky ~]# ls /usr/local/ocaml/
-bin lib man
-[root@Rocky ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
-[root@Rocky ~]# . /etc/profile
-```
-
-```bash
-[root@Rocky ~]# wget -c https://github.com/bcpierce00/unison/archive/refs/tags/v2.51.4.tar.gz
-[root@Rocky ~]# tar -zvxf v2.51.4.tar.gz -C /usr/local/src/
-[root@Rocky ~]# cd /usr/local/src/unison-2.51.4/
-[root@Rocky /usr/local/src/unison-2.51.4]# make UISTYLE=txt
-...
-[root@Rocky /usr/local/src/unison-2.51.4]# ls src/unison
-src/unison
-[root@Rocky /usr/local/src/unison-2.51.4]# cp -p src/unison /usr/local/bin
-```
-
-## Fedora 34 安装unison
-
-一样的操作。
-
-```bash
-[root@fedora ~]# wget -c https://github.com/ocaml/ocaml/archive/refs/tags/4.12.0.tar.gz
-[root@feodora ~]# tar -zvxf 4.12.0.tar.gz -C /usr/local/src/
-[root@fedora ~]# cd /usr/local/src/ocaml-4.12.0
-[root@fedora /usr/local/src/ocaml-4.12.0]# ./configure --prefix=/usr/local/ocaml && make world opt && make install
-...
-[root@fedora ~]# ls /usr/local/ocaml/
-bin lib man
-[root@fedora ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
-[root@fedora ~]# . /etc/profile
-```
-
-```bash
-[root@fedora ~]# wget -c https://github.com/bcpierce00/unison/archive/refs/tags/v2.51.4.tar.gz
-[root@fedora ~]# tar -zvxf v2.51.4.tar.gz -C /usr/local/src/
-[root@fedora ~]# cd /usr/local/src/unison-2.51.4/
-[root@fedora /usr/local/src/unison-2.51.4]# make UISTYLE=txt
-...
-[root@fedora /usr/local/src/unison-2.51.4]# ls src/unison
-src/unison
-[root@fedora /usr/local/src/unison-2.51.4]# cp -p src/unison /usr/local/bin
-```
-
-
-## 演示
-
-**我们的需求是 —— Rocky Linux 8的 /dir1/ 目录自动同步到Fedora 34的 /dir2/ 目录 ;同时Fedora 34的 /dir2/ 目录自动同步到Rocky Linux 8 的 /dir1/ 目录**
-
-### 配置Rcoky Linux 8
-
-```bash
-[root@Rocky ~]# mkdir /dir1
-[root@Rocky ~]# setfacl -m u:testrsync:rwx /dir1/
-[root@Rocky ~]# vim /root/unison1.sh
-#!/bin/bash
-a="/usr/local/inotify-tools/bin/inotifywait -mrq -e create,delete,modify,move /dir1/"
-b="/usr/local/bin/unison -batch /dir1/ ssh://testrsync@192.168.100.5//dir2"
-$a | while read directory event file
-do
- $b &>> /tmp/unison1.log
-done
-[root@Rocky ~]# chmod +x /root/unison1.sh
-[root@Rocky ~]# bash /root/unison1.sh &
-[root@Rocky ~]# jobs -l
-```
-
-### 配置Fedora 34
-
-```bash
-[root@fedora ~]# mkdir /dir2
-[root@fedora ~]# setfacl -m u:testrsync:rwx /dir2/
-[root@fedora ~]# vim /root/unison2.sh
-#!/bin/bash
-a="/usr/local/inotify-tools/bin/inotifywait -mrq -e create,delete,modify,move /dir2/"
-b="/usr/local/bin/unison -batch /dir2/ ssh://testrsync@192.168.100.4//dir1"
-$a | while read directory event file
-do
- $b &>> /tmp/unison2.log
-done
-[root@fedora ~]# chmod +x /root/unison2.sh
-[root@fedora ~]# bash /root/unison2.sh &
-[root@fedora ~]# jobs -l
-```
-
-!!! tip "注意!"
- 要双向同步的话,两个机器的脚本必须都需要启动才可以,否则会报错。
-
-!!! tip "注意!"
- 如果您要开机自启动这个脚本的话
- `[root@Rocky ~]# echo "bash /root/unison1.sh &" >> /etc/rc.local`
- `[root@Rocky ~]# chmod +x /etc/rc.local`
-
-!!! tip "注意!"
- 如果您要停止这个脚本的对应进程,可以在 `htop` 命令中找到它然后 **kill** 即可
+---
+title: 使用 unison
+author: tianci li
+contributors: Steven Spencer
+update: 2021-11-06
+---
+
+# 简述
+
+前面我们提到,单向同步使用的是rsync + inotify-tools。 在一些比较特殊的使用场景下可能需要双向同步,这就需要inotify-tools + unison。
+
+## 环境准备
+
+* Rocky Linux 8 与 Fedora 34 都需要源代码编译安装 **inotify-tools** ,这里不具体展开。
+* 两台机器都必须免密登录验证,这里我们使用的是SSH协议进行
+* [ocaml](https://github.com/ocaml/ocaml/) 使用v4.12.0,[unison](https://github.com/bcpierce00/unison/) 使用v2.51.4。
+
+环境准备好后,可以进行验证:
+
+```bash
+[root@Rocky ~]# inotifywa
+inotifywait inotifywatch
+[root@Rocky ~]# ssh -p 22 testrsync@192.168.100.5
+Last login: Thu Nov 4 13:13:42 2021 from 192.168.100.4
+[testrsync@fedora ~]$
+```
+
+```bash
+[root@fedora ~]# inotifywa
+inotifywait inotifywatch
+[root@fedora ~]# ssh -p 22 testrsync@192.168.100.4
+Last login: Wed Nov 3 22:07:18 2021 from 192.168.100.5
+[testrsync@Rocky ~]$
+```
+
+!!! tip "注意" 两台机器的配置文件 **/etc/ssh/sshd_config** 应该打开 PubkeyAuthentication yes
+
+## Rocky Linux 8 安装unison
+
+ocaml是一门编程语言,unison的底层依赖它。
+
+```bash
+[root@Rocky ~]# wget -c https://github.com/ocaml/ocaml/archive/refs/tags/4.12.0.tar.gz
+[root@Rocky ~]# tar -zvxf 4.12.0.tar.gz -C /usr/local/src/
+[root@Rocky ~]# cd /usr/local/src/ocaml-4.12.0
+[root@Rocky /usr/local/src/ocaml-4.12.0]# ./configure --prefix=/usr/local/ocaml && make world opt && make install
+...
+[root@Rocky ~]# ls /usr/local/ocaml/
+bin lib man
+[root@Rocky ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
+[root@Rocky ~]# . /etc/profile
+[root@Rocky ~]# ls /usr/local/ocaml/
+bin lib man
+[root@Rocky ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
+[root@Rocky ~]# . /etc/profile
+```
+
+```bash
+[root@Rocky ~]# wget -c https://github.com/bcpierce00/unison/archive/refs/tags/v2.51.4.tar.gz
+[root@Rocky ~]# tar -zvxf v2.51.4.tar.gz -C /usr/local/src/
+[root@Rocky ~]# cd /usr/local/src/unison-2.51.4/
+[root@Rocky /usr/local/src/unison-2.51.4]# make UISTYLE=txt
+...
+[root@Rocky /usr/local/src/unison-2.51.4]# ls src/unison
+src/unison
+[root@Rocky /usr/local/src/unison-2.51.4] cp -p src/unison /usr/local/bin
+```
+
+## Fedora 34 安装unison
+
+一样的操作。
+
+```bash
+[root@fedora ~]# wget -c https://github.com/ocaml/ocaml/archive/refs/tags/4.12.0.tar.gz
+[root@feodora ~]# tar -zvxf 4.12.0.tar.gz -C /usr/local/src/
+[root@fedora ~]# cd /usr/local/src/ocaml-4.12.0
+[root@fedora /usr/local/src/ocaml-4.12.0]# ./configure --prefix=/usr/local/ocaml && make world opt && make install
+...
+[root@fedora ~]# ls /usr/local/ocaml/
+bin lib man
+[root@fedora ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
+[root@fedora ~]# . /etc/profile
+[root@fedora ~]# ls /usr/local/ocaml/
+bin lib man
+[root@fedora ~]# echo PATH=$PATH:/usr/local/ocaml/bin >> /etc/profile
+[root@fedora ~]#. /etc/profile
+```
+
+```bash
+[root@fedora ~]# wget -c https://github.com/bcpierce00/unison/archive/refs/tags/v2.51.4.tar.gz
+[root@fedora ~]# tar -zvxf v2.51.4.tar.gz -C /usr/local/src/
+[root@fedora ~]# cd /usr/local/src/unison-2.51.4/
+[root@fedora /usr/local/src/unison-2.51.4]# make UISTYLE=txt
+...
+[root@fedora /usr/local/src/unison-2.51.4]# ls src/unison
+src/unison
+[root@fedora /usr/local/src/unison-2.51.4]# cp -p src/unison /usr/local/bin
+[root@fedora /usr/local/src/unison-2.51.4]# ls src/unison
+src/unison
+[root@fedora /usr/local/src/unison-2.51.4]# cp -p src/unison /usr/local/bin
+```
+
+
+## 演示
+
+**我们的需求是 —— Rocky Linux 8的 /dir1/ 目录自动同步到Fedora 34的 /dir2/ 目录 ;同时Fedora 34的 /dir2/ 目录自动同步到Rocky Linux 8 的 /dir1/ 目录**
+
+### 配置Rcoky Linux 8
+
+```bash
+[root@Rocky ~]# mkdir /dir1
+[root@Rocky ~]# setfacl -m u:testrsync:rwx /dir1/
+[root@Rocky ~]# vim /root/unison1.sh
+#!/bin/bash
+a="/usr/local/inotify-tools/bin/inotifywait -mrq -e create,delete,modify,move /dir1/"
+b="/usr/local/bin/unison -batch /dir1/ ssh://testrsync@192.168.100.5//dir2"
+$a | while read directory event file
+do
+ $b &>> /tmp/unison1.log
+done
+[root@Rocky ~]# chmod +x /root/unison1.sh
+[root@Rocky ~]# bash /root/unison1.sh &
+[root@Rocky ~]# jobs -l
+```
+
+### 配置Fedora 34
+
+```bash
+[root@fedora ~]# mkdir /dir2
+[root@fedora ~]# setfacl -m u:testrsync:rwx /dir2/
+[root@fedora ~]# vim /root/unison2.sh
+#!/bin/bash
+a="/usr/local/inotify-tools/bin/inotifywait -mrq -e create,delete,modify,move /dir2/"
+b="/usr/local/bin/unison -batch /dir2/ ssh://testrsync@192.168.100.4//dir1"
+$a | while read directory event file
+do
+ $b &>> /tmp/unison2.log
+done
+[root@fedora ~]# chmod +x /root/unison2.sh
+[root@fedora ~]# bash /root/unison2.sh &
+[root@fedora ~]# jobs -l
+```
+
+!!! tip "注意!" 要双向同步的话,两个机器的脚本必须都需要启动才可以,否则会报错。
+
+!!! tip "注意!" 如果您要开机自启动这个脚本的话 `[root@Rocky ~]# echo "bash /root/unison1.sh &" >> /etc/rc.local` `[root@Rocky ~]# chmod +x /etc/rc.local`
+
+!!! tip "注意!" 如果您要停止这个脚本的对应进程,可以在 `htop` 命令中找到它然后 **kill** 即可