Created
October 4, 2019 14:55
-
-
Save Spijkervet/c80a296f0c0d5eee49e42822053bc50d 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 | |
CWDIR=$1 | |
mkdir $CWDIR | |
echo 'Backing up to $CWDIR' | |
cd $CWDIR | |
export UGIDLIMIT=500 | |
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > $CWDIR/passwd.mig | |
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > $CWDIR/group.mig | |
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > $CWDIR/shadow.mig | |
cp /etc/gshadow $CWDIR/gshadow.mig | |
cp -r /var/spool/mail $CWDIR/mail | |
rsync -a --info=progress2 /home $CWDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment