CentOS 7.x Migrate ssh based file sharing server

From Notes_Wiki

Home > CentOS > CentOS 7.x > System Administration > New machine configuration > CentOS 7.x Migrate ssh based file sharing server

If there is file sharing server on public cloud such as AWS EC2 where files are transferred using ssh/sftp/rsync etc. then to migrate such server to new instance use following steps:

  1. Create instance with public SSH enabled from any IP
  2. In case of AWS ensure that public IP does not change on shutdown/power-on via Elastic IP
  3. Connect to instance using downloaded keypair:
    ssh -i <> centos@<ip>
  4. Get root terminal and install vim
    sudo su -
    yum -y install vim
  5. Allow key based access to root user using 'vim ~/.ssh/authorized_keys' from
    1. Downloaded key pair (Note 155x)
    2. Personal SSH key pair
    3. Backup server SSH key pair
    4. Older server being migrated
  6. Change hostname of the new VM
    vim /etc/hostname
    hostname
  7. Copy /etc/shadow, /etc/passwd, /etc/group from old server to new OR create the user account again on new server with same password
  8. Enable password based SSH using 'vim /etc/ssh/sshd_config' and update
    PasswordAuthentication yes
  9. Restart SSH for changes to take effect
    systemctl restart sshd
  10. Setup CentOS 7.x fail2ban
  11. Rsync files from older server to new server
    rsync -vaHz --delete /home/ root@<new-ip>:/home/
    After this do 'ls -al /home' on new server and ensure all UID/GID got migrated successfully
  12. Shutdown older server
  13. Update DNS entry, if any, to point to new server public (elastic) IP
  14. CentOS 7.x adding swap space using file


Home > CentOS > CentOS 7.x > System Administration > New machine configuration > CentOS 7.x Migrate ssh based file sharing server