报错代码
rpmdb BDB0113 Thread/process
解决方法
步骤一:删除 YUM 的软件数据库
# rm -rf /var/lib/rpm/_db*
步骤二:重建 YUM 的软件数据库
# rpm --rebuilddb
步骤三:清除 YUM 缓存
# yum clean all
步骤四:显示 YUM 是否恢复正常
# yum repolist
rpmdb BDB0113 Thread/process
# rm -rf /var/lib/rpm/_db*
# rpm --rebuilddb
# yum clean all
# yum repolist
# last
# ls -arlt /var/log/wtmp
-rw-rw-r--. 1 root utmp 294920 Jul 20 09:57 lastlog
# mv /var/log/wtmp /var/log/wtmp.backup
# touch /var/log/wtmp
# chown root:utmp /var/log/wtmp
# last
wtmp begins Mon Jul 20 10:07:11 2020
# getenforce
# vim /etc/selinux/config
将以下内容:
......
SELINUX=disabled
......
修改为:
......
SELINUX=enforcing
......
# reboot
# setenfoce 1
(补充:系统重启后失效)
# semanage boolean -l
# setsebool <boolean value> 1
或者:
# setsebool <boolean value> on
# setsebool httpd_can_network_connect 1
或者:
# setsebool httpd_can_network_connect on
# setsebool -P <boolean value> 1
或者:
# setsebool -P <boolean value> on
# setsebool -P httpd_can_network_connect 1
或者:
# setsebool -P httpd_can_network_connect on
# setsebool <boolean value> 0
或者:
# setsebool <boolean value> off
# setsebool httpd_can_network_connect 0
或者:
# setsebool httpd_can_network_connect off
# setsebool -P <boolean value> 0
或者:
# setsebool -P <boolean value> off
# setsebool -P httpd_can_network_connect 0
或者:
# setsebool -P httpd_can_network_connect off
名称:只对某个 IP 地址开放 TCP 22 端口
作用:只对某个 IP 地址开放 TCP 22 端口
1. 给此脚本添加执行权限
2. 执行此脚本
ipaddress=192.168.1.1 #要开放 TCP 22 端口的 IP 地址
#!/bin/bash
####################### Separator ########################
ipaddress=192.168.1.1
####################### Separator ########################
systemctl stop firewalld
systemctl disable firewalld
yum -y install iptables-services
zypper -n install iptables
systemctl enable iptables
systemctl start iptables
sysctl -w net.ipv4.ip_forward=1
iptables -t filter -F
iptables -t nat -F
iptables -P OUTPUT ACCEPT
#iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
iptables -t filter -A INPUT -j ACCEPT -s $ipaddress -p tcp --destination-port 22
iptables -t filter -A INPUT -j DROP -p tcp --destination-port 22
service iptables save
systemctl restart iptables
作者:朱明宇
名称:取消所有已开放的端口策略
作用:取消所有已开放的端口策略
1. 给此脚本添加执行权限
2. 执行此脚本
#!/bin/bash
systemctl start firewalld
systemctl enable firewalld
for i in `firewall-cmd --list-all | grep ports | egrep [0-9] | awk -F':' '{print $2}'`
do
pports=`echo $i | awk -F'/' '{print $1}'`
ptus=`echo $i | awk -F'/' '{print $2}'`
firewall-cmd --remove-port=$pports/$ptus --permanent
done
firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload