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 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 total 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 total size is 155744? speedup is 967.35 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |