Created
September 12, 2023 12:22
-
-
Save jonasbjork/e2d0a7cb93182bc3d6303cb46d9d2b94 to your computer and use it in GitHub Desktop.
Delete users based on uid (bash, ubuntu)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for u in $(seq 1001 1004); do | |
echo "debug -> $u" | |
id ${u} &>/dev/null | |
if [ $? -eq 0 ] ; then | |
NAMN=$(id -nu ${u}) | |
sudo userdel -r ${NAMN} | |
else | |
echo "ID NOT" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Det var en snabb fix Jonas ๐๐