- /etc/passwd
- /etc/group
- /etc/shadow
- home directories and shared directories
- /etc/samba
- /var/lib/samba
2.1 Old server
[root@old-server ~]# mkdir /root/move
[root@old-server ~]# export UGIDLIMIT=500
[root@old-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move/passwd.mig
[root@old-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/move/group.mig
[root@old-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig
cp /etc/gshadow /root/move/gshadow.mig
2.2 copy to new server
rsync -ahrvz ssh /root/move 172.16.xx.xx:/root/move
OR
tar -czvf move.tar.gz move
scp move.tar.gz root@172.16.xx.xxx:/root
tar -czvf move.tar.gz move
scp move.tar.gz root@172.16.xx.xxx:/root
2.3 Import user & passwd to new server (should be backup usernam&passwd before import data)
[root@new-server ~]# cd /root/move
[root@new-server ~]# cat passwd.mig >> /etc/passwd
[root@new-server ~]# cat group.mig >> /etc/group
[root@new-server ~]# cat shadow.mig >> /etc/shadow
cp gshadow.mig /etc/gshadow
สุดท้ายให้ก็อปปี้ user and passwd ในห้อง /etc/samba จากเครืองเก่าไปวางไว้ที่เครืองใหม่
/etc/samba
smbpasswd
smbusers
* for Centos v7
ให้ก็อปปี้เฉพาะไฟล์ smbpasswd ไปไว้ที่ Folder นี้
/var/lib/samba/private/
Ref:
1. migrating-samba-server-and-users-in.html
2. howto-move-migrate-user-accounts-old-to-new-server/
3. http://amar-linux.blogspot.com/2012/03/migrating-samba-server-and-users-in.html
No comments:
Post a Comment