How to Migrate Account Information Between Linux Servers

  

1. Back up the passwd, group, and shadow files to the file on the server that needs to be backed up

awk -v LIMIT=$UGIDLIMIT -F: ' ($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move20110111/passwd.migawk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) & ;& ($3!=65534)' /etc/group > /root/move20110111/group.migawk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534 ) {print $1}' /etc/passwd |  Tee - | Egrep -f - /etc/shadow > /root/move20110111/shadow.mig

2. Transfer the backed up files to the new server using the appropriate method, such as SCP command
scp - r /root/move20110111/* [email protected]:/root/move20110111

3. Import the backup account information on the new server to
cat passwd.mig >> /etc/passwdcat group. Mig >> /etc/groupcat shadow.mig >> /etc/shadow

4. Restart # reboot

Copyright © Windows knowledge All Rights Reserved