Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Rsync 恢复 libselinux.SO.1大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

libselinux.SO.1  这个文件对 CentOS 7很重要, 误删掉后,会导致很多命令无法使用(比如yum ,rpm  命令),利用rsync这个工具来修复。 服务端执行如下配置:(选取正常的 一台机器做服务端) vim /etc/rsyncd.conf port = 873 uid = root gid = root use chroot = yes re

libselinux.so.1  这个文件对 CentOS 7很重要, 误删掉后,会导致很多命令无法使用(比如yum,rpm  命令),利用rsync这个工具来修复。

服务端执行如下配置:(选取正常的 一台机器做服务端)

vim /etc/rsyncd.conf

port = 873

uid = root

gid = root

use chroot = yes

read only = yes

#limit access to private LANs

max connections =10

pid file = /var/run/rsyncd.pid

log file = /var/log/rsyncd.log

timeout = 300

[tmp]                                                   //tmp  模块

path = /tmp/

list = yes

auth users = root

uid = root

gid = root

exclude = *.xml *.properties *.log

secrets file = /etc/rsyncd.pass

read only = no

 

注意:

1. 配置文件中auth users 写了哪个用户,哪个用户就可以访问,没写的就不能访问,密码访问一旦开启,所有人都要输入密码,所以没有在auth users中指定的用户是无法访问的。

2. 密码文件的属主必须是rsync服务的运行者,权限必须是600。例如:root运行rsync –daemon,则secrets file的owner也必须是root;secrets file权限必须是600。

3. 这个用中括号包围的"[tmp]"就是rsync中所谓的模块,tmp为模块ID,必须保证唯一,每个模块中必须定义一项"path",path定义的是该模块代表的路径,例如此示例文件中,如果想请求tmp模块,则在客户端使用"rsync [email protected]::tmp",这表示访问[email protected]上的/home/ftp目录,如果要访问/home/ftp目录下的子目录www,则"rsync [email protected]::ftp1/www"。

 

echo "root:abc123" > /etc/rsyncd.pass          //root 表示用户名, abc123 表示密码

启动rsync命令: rsync --daemon --config=/etc/rsyncd.conf     // daemon  方式运行

                             systemctl start rsyncd             // CentOS 7 启动方式

 

[[email protected] ~]# rsync -aPv /lib64/libselinux.so.1 /tmp

sending incremental file list

libselinux.so.1

      155744 100%  117.28MB/s    0:00:00 (xfer#1,to-check=0/1)

sent 155843 bytes  received 31 bytes  311748.00 bytes/sec

@R_676_10586@l size is 155744  speedup is 1.00

 

客户端执行如下操作:(被误删的libselinux.so.1 的机器作为客户端,去正常的服务端拉取lib包)

[[email protected] ~]]# echo "abc123" > /etc/rsyncd.pass

[[email protected] ~]# rsync -aPv 192.168.1.25::tmp/libselinux.so.1 /lib64

password:

receiving incremental file list

sent 53 bytes  received 108 bytes  24.77 bytes/sec

@R_676_10586@l size is 155744  speedup is 967.35

大佬总结

以上是大佬教程为你收集整理的Rsync 恢复 libselinux.SO.1全部内容,希望文章能够帮你解决Rsync 恢复 libselinux.SO.1所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:1rsync恢复