Enumerate
Enum Script
#!/bin/bash
# Define an array of potential autostart script locations
autostart_locations=(
"/etc/rc.local"
"/etc/rc.d/rc.local"
"/etc/init.d"
"/etc/systemd/system"
"/etc/systemd/system/multi-user.target.wants/"
"/etc/systemd/user"
"/usr/lib/systemd/system"
"/lib/systemd/system"
"/etc/xdg/autostart"
"/home/$USER/.config/autostart"
)
# Function to check file/directory and print details
check_and_print() {
local path="$1"
if [ -e "$path" ]; then
# Check if the current user has write permission
if [ -w "$path" ]; then
# Print path in red with permissions
echo -e "\033[31m$(ls -ld "$path")\033[0m"
else
# Print path with permissions
echo "$(ls -ld "$path")"
fi
fi
}
# Iterate over locations and check each
for location in "${autostart_locations[@]}"; do
if [ -d "$location" ]; then
# If it's a directory, check each file in it
for file in "$location"/*; do
check_and_print "$file"
done
else
# If it's a file, just check the file
check_and_print "$location"
fi
doneSystem-wide Startup Files
File/Directory
Description
User-specific Startup Files
Bourne-Again Shell (bash)
Z Shell (zsh)
C Shell (csh) or TENEX C Shell (tcsh)
Korn Shell (ksh)
SysV Init
Systemd
Upstart
Last updated