Wrap-exec

From Noah.org
Jump to navigationJump to search


#!/bin/sh

Migrate Users From Old Linux box to new Linux box

#!/bin/sh

#
# This script helps migrate user accounts to a new server.
#

IDMIN=1000
IDMAX=29999
DESTDIR=/root/migrate

if [ $(id -u) -ne 0 ]; then 
    echo "You must be root to run this."
fi

mkdir -p ${DESTDIR}
cd /etc
awk -v VIDMIN=IDMIN -v VIDMAX=IDMAX -F: '(3VIDMIN) (3VIDMAX)' passwd  DESTDIR/passwd.old

cp /etc/gshadow ${DESTDIR}/gshadow.old
cp /etc/sudoers ${DESTDIR}/sudoers.old

tar czf ${DESTDIR}/etc.tar.gz ${DESTDIR}/*.old
#tar czpf ${DESTDIR}/home.tar.gz /home
echo "WARNING! Not including /home in the migration."

# vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'