Skip to content

Commit

Permalink
Change the new openroot account
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyunjie committed May 6, 2021
1 parent 204afb3 commit b979b13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions Protective_Script/CentOS_Protective_Script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,23 @@ fi
################################新增超级管理员用户################################
function create_user(){
echo "#########################################################################################"
echo -e "\033[1;31m 3、Create eproot account \033[0m"
echo -e "\033[1;31m 3、Create openroot account \033[0m"
echo "#########################################################################################"
read -p "Be sure to create an eproot account?[y/n]:"
read -p "Be sure to create an openroot account?[y/n]:"
case $REPLY in
y)
grep -i 'eproot' /etc/passwd
grep -i 'openroot' /etc/passwd
if [ $? == 0 ];then
echo -e "\033[1;31m An eproot account has been created \033[0m"
echo -e "\033[1;31m An openroot account has been created \033[0m"
else
read -p "Please enter your password:" PASSWD
useradd -g root eproot;echo "$PASSWD" | passwd --stdin eproot > /dev/null
useradd -g root openroot;echo "$PASSWD" | passwd --stdin openroot > /dev/null
if [ $? == 0 ];then
echo -e "\033[1;31m eproot account created successfully \033[0m"
grep -i "eproot" /etc/sudoers
echo -e "\033[1;31m openroot account created successfully \033[0m"
grep -i "openroot" /etc/sudoers
if [ $? != 0 ];then
chmod u+w /etc/sudoers > /dev/null
sed -i '/^root.*ALL=(ALL).*$/a\eproot ALL=(ALL) NOPASSWD:ALL' /etc/sudoers > /dev/null
sed -i '/^root.*ALL=(ALL).*$/a\openroot ALL=(ALL) NOPASSWD:ALL' /etc/sudoers > /dev/null
if [ $? == 0 ];then
echo -e "\033[37;5m [Permissions set success] \033[0m"
else
Expand All @@ -155,7 +155,7 @@ function create_user(){
echo -e "\033[1;31m Permissions have already been set \033[0m"
fi
else
echo -e "\033[1;31m eproot account created failed \033[0m"
echo -e "\033[1;31m openroot account created failed \033[0m"
exit 1
fi
fi
Expand Down Expand Up @@ -354,7 +354,7 @@ function main(){
# Menu #
# 1:ALL protective #
# 2:Set Password Complexity Requirements #
# 3:Create eproot account #
# 3:Create openroot account #
# 4:Set Remote Login Configuration(SSH) #
# 5:Set Shell History and TMOUT #
# 6:Set SSH Port #
Expand Down
4 changes: 2 additions & 2 deletions Protective_Script/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
功能说明:
1、ALL protective 一键进行全部加固
2、Set Password Complexity Requirements 设置密码复杂度
3、Create eproot account 添加eproot账号
3、Create openroot account 添加openroot账号
4、Set Remote Login Configuration(SSH) 禁止root远程登入
5、Set Shell History and TMOUT 设置history保存行数以及命令时间,设置窗口超时时间
6、Set SSH Port 更改SSH端口
Expand All @@ -40,7 +40,7 @@ Date: 2019-03-08
------------------------

Date: 2019-03-18
添加新增eproot账号功能,防止系统没有除root账号外的其余账号,配置了禁止root远程,导致系统无法登入
添加新增openroot账号功能,防止系统没有除root账号外的其余账号,配置了禁止root远程,导致系统无法登入

----------------------

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sudo sh CentOS_Protective_Script.sh
**功能说明**
- 一键进行全部加固
- 设置密码复杂度
- 添加eproot账号
- 添加openroot账号
- 禁止root远程登入
- 设置history保存行数以及命令时间,设置窗口超时时间
- 更改SSH端口
Expand Down

0 comments on commit b979b13

Please sign in to comment.