mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
updated rollback and error messeges
This commit is contained in:
@@ -75,7 +75,7 @@ sha256sum du_setup.sh
|
||||
|
||||
Compare the output hash to the one below. They must match exactly.
|
||||
|
||||
`239f83b90b29311f07c5c8f263da58c06452042ed41700a172b520ec7ce3f40b`
|
||||
`e40b6015951c9d1f14b50ad3f923cc29d644dfcef982cb8543830f6cc8e573c3`
|
||||
|
||||
### 3\. Run the Script
|
||||
|
||||
|
||||
13
du_setup.sh
13
du_setup.sh
@@ -3,7 +3,8 @@
|
||||
# Debian 12 and Ubuntu Server Hardening Interactive Script
|
||||
# Version: 0.54 | 2025-07-02
|
||||
# Changelog:
|
||||
# - v0.54: Fix for rollback_ssh_changes() - more reliable on newer Ubuntu
|
||||
# - v0.54: Fix for rollback_ssh_changes() - more reliable on newer Ubuntu
|
||||
# Better error message if script is executed by non-root or without sudo
|
||||
# - v0.53: Fix for test_backup() - was failing if run as non root sudo user
|
||||
# - v0.52: Roll-back SSH config on failure to configure SSH port, confirmed SSH config support for Ubuntu 24.10
|
||||
# - v0.51: corrected repo links
|
||||
@@ -2095,6 +2096,16 @@ handle_error() {
|
||||
|
||||
main() {
|
||||
trap 'handle_error $LINENO' ERR
|
||||
|
||||
# --- Root Check ---
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo -e "\n${RED}✗ Error: This script must be run with root privileges.${NC}"
|
||||
echo "You are running as user '$(whoami)', but root is required for system changes."
|
||||
echo -e "Please re-run the script using 'sudo -E':"
|
||||
echo -e " ${CYAN}sudo -E ./du_setup.sh${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch "$LOG_FILE" && chmod 600 "$LOG_FILE"
|
||||
log "Starting Debian/Ubuntu hardening script."
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
239f83b90b29311f07c5c8f263da58c06452042ed41700a172b520ec7ce3f40b du_setup.sh
|
||||
e40b6015951c9d1f14b50ad3f923cc29d644dfcef982cb8543830f6cc8e573c3 du_setup.sh
|
||||
|
||||
Reference in New Issue
Block a user