Rsync 恢復(fù) libselinux.SO.1

libselinux.SO.1? 這個文件對 CentOS 7很重要, 誤刪掉后,會導(dǎo)致很多命令無法使用

(比如yum ,rpm? 命令),利用rsync這個工具來修復(fù)。

服務(wù)端執(zhí)行如下配置:(選取正常的 一臺機器做服務(wù)端)

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服務(wù)的運行者,權(quán)限必須是600。例如:root運行rsync –daemon,則secrets file的owner也必須是root;secrets file權(quán)限必須是600。

3. 這個用中括號包圍的"[tmp]"就是rsync中所謂的模塊,tmp為模塊ID,必須保證唯一,每個模塊中必須定義一項"path",path定義的是該模塊代表的路徑,例如此示例文件中,如果想請求tmp模塊,則在客戶端使用"rsync user@host::tmp",這表示訪問user@host上的/home/ftp目錄,如果要訪問/home/ftp目錄下的子目錄www,則"rsync user@host::ftp1/www"。


echo "root:abc123" > /etc/rsyncd.pass????????? //root 表示用戶名, abc123 表示密碼

啟動rsync命令: rsync --daemon --config=/etc/rsyncd.conf???? // daemon? 方式運行

???????????????????????????? systemctl start rsyncd?????? ? ? ? // CentOS 7 啟動方式


[root@web-01 ~]# 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



客戶端執(zhí)行如下操作:(被誤刪的libselinux.so.1 的機器作為客戶端,去正常的服務(wù)端拉取lib包)

[root@web-02 ~]]# echo "abc123" > /etc/rsyncd.pass

[root@web-02 ~]# 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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容