From 4e1f64e32083c8f94a861dd66b020cc63597711d Mon Sep 17 00:00:00 2001 From: zebra Date: Wed, 24 Jul 2024 15:52:48 -0700 Subject: [PATCH] new script to change shell for all users, not just root --- izebra-linux-oneshot.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/izebra-linux-oneshot.sh b/izebra-linux-oneshot.sh index dae66be..4d80a5b 100644 --- a/izebra-linux-oneshot.sh +++ b/izebra-linux-oneshot.sh @@ -75,6 +75,15 @@ done #Change default shell to fish echo Changing default shell to fish -chsh -s /usr/bin/fish - +# Loop through all users in /etc/passwd +while IFS=: read -r username _ _ _ _ homedir _; do + # Skip system accounts and users without a home directory + if [[ $homedir != "/nonexistent" && -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 + fi +done < /etc/passwd