Created
July 6, 2017 18:32
-
-
Save dflima/2e0257a18330aecc368f7af4dd881dd4 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
for user in $@; do | |
now=$(date +"%Y-%m-%d") | |
uid=$(id -u $user) | |
# Lock user account | |
passwd -l $user | |
tar -zcvf /home/dflima/$user.$uid.$now.tar.gz /home/$user | |
# Kill user session | |
killall -KILL -u $user | |
# Delete user jobs | |
# find /var/spool/at/ -name "[^.]*" -type f -user $user -delete | |
# Delete user account | |
userdel -r $user | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment