|
6 | 6 | # Locking the root account doesn't prevent users from using something like `sudo su` |
7 | 7 | # to gain root access. |
8 | 8 | # |
9 | | -# Version: v1.0.7 |
| 9 | +# Version: v1.0.8 |
10 | 10 | # License: MIT License |
11 | 11 | # Copyright (c) 2020-2024 Hunter T. (StrangeRanger) |
12 | 12 | # |
13 | 13 | ######################################################################################## |
14 | 14 |
|
15 | 15 | C_GREEN="$(printf '\033[0;32m')" |
| 16 | +C_BLUE="$(printf '\033[0;34m')" |
| 17 | +C_CYAN="$(printf '\033[0;36m')" |
16 | 18 | C_RED="$(printf '\033[1;31m')" |
17 | 19 | C_NC="$(printf '\033[0m')" |
18 | 20 |
|
| 21 | +C_SUCCESS="${C_GREEN}==>${C_NC} " |
| 22 | +C_ERROR="${C_RED}ERROR:${C_NC} " |
| 23 | +C_INFO="${C_BLUE}==>${C_NC} " |
| 24 | +C_NOTE="${C_CYAN}==>${C_NC} " |
| 25 | + |
19 | 26 |
|
20 | 27 | ## Check if this script was executed with root privilege. |
21 | 28 | if [[ $EUID != 0 ]]; then |
22 | | - echo "${C_RED}Please run this script as or with root privilege${C_NC}" >&2 |
23 | | - echo -e "\nExiting..." |
| 29 | + echo "${C_ERROR}Please run this script as or with root privilege" >&2 |
| 30 | + echo -e "\n${C_INFO}Exiting..." |
24 | 31 | exit 1 |
25 | 32 | fi |
26 | 33 |
|
27 | 34 |
|
28 | | -read -rp "We will now disable the root account. Press [Enter] to continue." |
| 35 | +read -rp "${C_NOTE}We will now disable the root account. Press [Enter] to continue." |
29 | 36 |
|
30 | | -echo "Disabling root account..." |
| 37 | +echo "${C_INFO}Disabling root account..." |
31 | 38 | usermod -L root || { |
32 | | - echo -e "${C_RED}ERROR:${C_NC} Failed to lock the root account" >&2 |
33 | | - echo -e "\nExiting..." |
| 39 | + echo -e "${C_ERROR}Failed to lock the root account" >&2 |
| 40 | + echo -e "\n${C_INFO}Exiting..." |
34 | 41 | exit 1 |
35 | 42 | } |
36 | 43 |
|
37 | | -echo -e "\n${C_GREEN}The root account has been locked${C_NC}" |
| 44 | +echo -e "\n${C_SUCCESS}The root account has been locked" |
0 commit comments