Linux User Migration

Source: Internet
Author: User
Tags rsync

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.