当前位置:网站首页>Initialization script

Initialization script

2022-07-07 12:57:00 LC181119

Initialization script

#!/bin/bash
#********************************************************************
#Date:        2021-12-15
#FileName:    reset.sh
#Description: The test script
#********************************************************************
disable_selinux(){
 	sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  echo "SElinux Has been disabled , It will not take effect until it is restarted " 
}
disable_firewall(){
 systemctl disable --now firewalld &> /dev/null
 echo " Firewall disabled "
}
set_ps1() {
 echo "PS1='\[\e[1;35m\][\[email protected]\h \W]\\$\[\e[0m\]'" > /etc/profile.d/reset.sh
 echo " The prompt has been modified successfully , Please login again to take effect " 
}
set_eth(){
 sed -i.bak  '/GRUB_CMDLINE_LINUX=/s#"$# net.ifnames=0"#' /etc/default/grub
 grub2-mkconfig -o /boot/grub2/grub.cfg &> /dev/null
 echo " The network name has been modified successfully , Please restart to take effect "
}
PS3=" Please select the corresponding number (1-6): "
MENU='
 Ban SELinux
 Turn off the firewall 
 Modify the prompt 
 Modify the network card name 
 All the above are realized 
 sign out 
'
select M in $MENU ;do
case $REPLY in
1)
 disable_selinux
 ;;
2)
 disable_firewall
 ;;
3)
 set_ps1
 ;;
4) 
 set_eth
 ;;
5) 
 disable_selinux
 disable_firewall
 set_ps1
 set_eth
 ;;
6)
 break
 ;;
*)
 echo " Please enter the correct number "
 ;;
esac
done

原网站

版权声明
本文为[LC181119]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130616434165.html