误删除系统libselinux.so.1之后

不小心误删 libselinux.so.1之后,执行大部分系统命令时就开始报告:

error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory

系统命令无法使用,远程连接无法连接.

!!补救措施受各种条件限制,未必能够成功!!
所以建议
1、 对一些系统包的变更要慎重,慎之又慎。
例如

yum 不要随便卸载
libselinux 不要随便卸载
待续
2、对关键文件预先进行备份
例如本例中的 libselinux.so.1 ,费半天劲也不过就是恢复这个文件,如果预先备份了该文件,就不用大费周章了

解决办法:使用 rsync 来恢复该文件
步骤

1、在你的服务器上开启一个 rsync 服务端
cat > /etc/rsyncd.conf <<EOF
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]
path = /tmp/
list = yes
auth users = root
uid = root
gid = root
 
exclude = *.xml *.properties *.log
secrets file = /etc/rsyncd.pass
read only = no
EOF
 
 
echo "root:123.com" > /etc/rsyncd.pass
chmod 600 /etc/rsyncd.pass
 
# 启动服务
rsync --daemon --config=/etc/rsyncd.conf
# 停止服务
cat /var/run/rsyncd.pid | xargs kill -9 && rm -rf /var/run/rsyncd.pid
 
2、客户端将 libselinux.so.1同步到服务器
echo "123.com" > /etc/rsyncd.pass
chmod 600 /etc/rsyncd.pass
server_ip=192.168.1.11
rsync -aPv --port 873 /lib64/libselinux.so.1 ${server_ip}::tmp

rsync: failed to connect to 192.168.xx.xxx: No route to host (113) 
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6] 
对方没开机、防火墙阻挡、通过的网络上有防火墙阻挡

关闭防火墙,或者把防火墙的tcp udp 的873端口打开,允许rsync通过。

3、在服务端将 libselinux.so.1 移动到 /lib64/ 下
rsync -aPv /tmp/libselinux.so.1 /lib64

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值