标签:sed 临时 文件权限 设置密码 规则 start 场景 时间 业务
sh-4.2# awk -F: ‘{print $1}‘ /etc/passwd | grep -E -v "root|ftp*" | xargs -n 1 passwd -l
sh-4.2# useradd -u 917 User sh-4.2# groupmod -g 917 User
sh-4.2# sed -i ‘s:#UseDNS no:UseDNS no:‘ /etc/ssh/sshd_config sh-4.2# systemctl reload sshd.service
sh-4.2# chage -d 0 User # 初次登录必须更改密码 sh-4.2# chage -M 90 -m 7 -W 7 User #用户90天后密码过期,至少7天后才能修改密码,密码过期前7天开始收到告警信息 sh-4.2# vi /etc/login.defs PASS_MAX_DAYS 90 PASS_MIN_LEN 8
sh-4.2# echo "TMOUT=1800" >> /etc/profile sh-4.2# source /etc/profile
sh-4.2# sed -i ‘1,$ s/^/#/‘ /usr/lib/systemd/system/ctrl-alt-del.target sh-4.2# init q
sh-4.2# sed -i ‘$a * soft nofile 65535‘ /etc/security/limits.conf sh-4.2# sed -i ‘$a * hard nofile 65535‘ /etc/security/limits.conf sh-4.2# ulimit -n 65535 # 临时设置
sh-4.2# sed -i ‘$a net.ipv6.conf.all.disable_ipv6 = 1‘ /etc/sysctl.conf sh-4.2# sed -i ‘$a net.ipv6.conf.default.disable_ipv6 = 1‘ /etc/sysctl.conf sh-4.2# sysctl -p
此内容参考:https://linux.cn/article-4935-1.html
sh-4.2# chmod 700 /usr/bin/ping sh-4.2# chmod 700 /usr/bin/who sh-4.2# chmod 700 /usr/bin/w sh-4.2# chmod 700 /usr/bin/whereis sh-4.2# chmod 700 /usr/sbin/ifconfig sh-4.2# chmod 700 /usr/bin/gcc sh-4.2# chmod 700 /usr/bin/make sh-4.2# chmod 700 /usr/bin/rpm sh-4.2# chattr +i /etc/passwd sh-4.2# chattr +i /etc/shadow sh-4.2# chattr +i /etc/group sh-4.2# chattr +i /etc/gshadow sh-4.2# chattr +a /root/.bash_history sh-4.2# chattr +i /root/.bash_history
sh-4.2# rpm -qa | grep "firewall" | xargs rpm -e --nodeps sh-4.2# yum list iptables* sh-4.2# systemctl start iptables sh-4.2# iptables -F sh-4.2# iptables -A INPUT -p tcp --dport 22 -j ACCEPT sh-4.2# iptables -A INPUT -j DROP sh-4.2# service iptables save # 这里只是简单的列出基本的iptables规则,主要还是根据自己的业务场景进行设定
标签:sed 临时 文件权限 设置密码 规则 start 场景 时间 业务
原文地址:https://www.cnblogs.com/guge-94/p/10451888.html