zoukankan      html  css  js  c++  java
  • 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 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

    客户端执行如下操作:(被误删的libselinux.so.1 的机器作为客户端,去正常的服务端拉取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

  • 相关阅读:
    U盘备份工具
    改进的窗口置顶工具
    有关DLL中封装的MDI子窗体出现TFont错误的解释
    QQ风格程序的编写
    改进的自动按键工具
    万能Update语句
    在DLL中封装的VCL窗体Tab键响应的问题
    自动按键工具
    灵活控制SVN服务
    在DLL动态链接库中封装VCL的MDI子窗体
  • 原文地址:https://www.cnblogs.com/yyy-blog/p/10696989.html
Copyright © 2011-2022 走看看