Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "This will migrate all the user account from this server to a new one"
- mkdir /root/move/
- export UGIDLIMIT=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 $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig
- cp /etc/gshadow /root/move/gshadow.mig
- tar -zcvpf /root/move/home.tar.gz /home
- tar -zcvpf /root/move/mail.tar.gz /var/spool/mail
- echo "Please enter the IP to migrate to: "
- read input_variable
- echo "Please enter the SSH port: "
- read input_variable2
- scp -P $input_variable2 -r /root/move/* root@$input_variable:/root/
- scp -P $input_variable2 -r /root/import.sh root@$input_variable:/root/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement