Blogs » WildCoast.Com's blog

Server migration - users

Debian/Ubuntu only UID numbering!

mount -o nolock 10.10.122.1:/nfs/share /mnt/

export UGIDLIMIT=1000
cd /nfs/share/ff/move
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999)' /etc/passwd > move/passwd.mig
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999)' /etc/group > move/group.mig
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > move/shadow.mig
less move/passwd.mig ls -ltr move/
ls -ltr move/

rsync -avz /home/ .

cp /etc/gshadow move/gshadow.mig

cd /nfs/share/ff/home
rsync -avz /home/ .

umount /mnt

# cd /path/to/location
# cat passwd.mig >> /etc/passwd
# cat group.mig >> /etc/group
# cat shadow.mig >> /etc/shadow
#NO NO cp gshadow.mig /etc/gshadow
 

Add new comment