One: Purpose.
Existing server users, fully migrating to a new server.
II: Environment:
Source: 117
Cat/etc/redhat-release
CentOS Release 6.9 (Final)
Rpm-qa rsync
Rsync-3.0.6-12.el6.x86_64
Purpose 114
Cat/etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
Three:
117:
Export ugidlimit=500//Set a variable, the new UID starts at 500.
Awk-v limit= $UGIDLIMIT-F: ' ($3>=limit) && ($3!=65534) '/etc/passwd >/root/move/passwd.mig
Awk-v limit= $UGIDLIMIT-F: ' ($3>=limit) && ($3!=65534) '/etc/group >/root/move/group.mig
Awk-v limit= $UGIDLIMIT-F: ' ($3>=limit) && ($3!=65534) {print $} '/etc/passwd | Tee-|egrep-f-/etc/shadow >/root/move/shadow.mig
Cp/etc/gshadow/root/move/gshadow.mig
RSYNC-E ssh-avpr/root/move/[Email protected]:/tmp/temp//Copy the old server's 4 files to the new server.
RSYNC-E ssh-avpr/home [Email protected]:///Copy the entire home directory on the old server to the new server.
This example does not consider/var/spool/mail
Four: 114:
Cat Passwd.mig >>/etc/passwd
Cat Group.mig >>/etc/group
Cat Shadow.mig >>/etc/shadow
CP Gshadow.mig/etc/gshadow
[[email protected] home]# Ls-sail/etc/{passwd,group,shadow,gshadow}
135184942 4-rw-r--r--. 1 root root 731 12:38/etc/group
135184896 4----------. 1 root root 509 12:39/etc/gshadow
135411669 4-rw-r--r--. 1 root root 1598 12:38/etc/passwd
135411670 4----------. 1 root root 1854 12:38/etc/shadow
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
This article is from the "Old white" blog, please be sure to keep this source http://laobai.blog.51cto.com/10345/1956418
Linux User Migration