From 54e5ed5918bc1899678e6438b3700c98b21e1ab5 Mon Sep 17 00:00:00 2001 From: zebra Date: Wed, 24 Jul 2024 15:57:57 -0700 Subject: [PATCH] Oops that altered a shitton of system accounts. script will now only affect UID 0 and 1000+ --- izebra-linux-oneshot.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/izebra-linux-oneshot.sh b/izebra-linux-oneshot.sh index 4d80a5b..439e26a 100644 --- a/izebra-linux-oneshot.sh +++ b/izebra-linux-oneshot.sh @@ -75,15 +75,20 @@ done #Change default shell to fish echo Changing default shell to fish +# Minimum UID for regular user accounts (adjust as necessary) +MIN_UID=1000 + # Loop through all users in /etc/passwd -while IFS=: read -r username _ _ _ _ homedir _; do +while IFS=: read -r username _ uid _ _ homedir _; do # Skip system accounts and users without a home directory - if [[ $homedir != "/nonexistent" && -d $homedir ]]; then + if [[ $uid -ge $MIN_UID && -d $homedir ]]; then echo "Changing shell for user: $username" sudo chsh -s /usr/bin/fish "$username" if [ $? -ne 0 ]; then echo "Failed to change shell for user: $username" fi + else + echo "Skipping system account or user without home directory: $username" fi done < /etc/passwd - +chsh -s /usr/bin/fish