How To Migrate Linux Server To New Server And How To Transfer Files Between Linux and Windows

Move or migrate user accounts from old Linux server to a new Linux Server

Linux is one of the famed OS systems used by the billions of users across the world. Linux is never easy to operate like other OS due to its coding functionally. If you are a Linux user and want to migrate your current server or user to a new server, then hopefully it will little difficult for you. Is that so? Then read this article and follow the mentioned steps.

How to migrate Linux server to new server?

Do you want to move your OS and data from Linux server to a new server? Then there are lots of considerations that you will need before migration to a new server. With the help of below instructions, you can make this process too easy:

  • Make Backups of your Data

First of all, you need to make a backup of all your important data that will help to recover all your data if something went wrong. There are many ways to backup your data such as an external hard drive, USB etc.

  • Collect information about the Source System

After backup, you need to match your target system and source system information. With uname command, you will get help to decide which server system to create for the new machine.

If you see i686, then it means that it is a 32-bit system. If it is indicating x86_64, then it is a 64-bit system.

  • Setup SSH key between your source and target server

With the help of SSH key, you can make a communication between two servers that will help in transferring files or data. For this, create a new key on your target server and then add it to the source server files.

  • Create a Migration Script

Creating a migration script will help to re-run the commands. You can without much of stretch make a simple migration script into root user’s home.

  • Specify the version constraints and installing

If you are using an Ubuntu machine, then you need to update and match your source machine’s repositories update. So try to install the software version that you need to install on your target machine.

After doing all these steps, you can easily migrate your current Linux server to a new server.

How to migrate users from one Linux server to another?

If you want to migrate Linux users to another server, then you need to apply the below methods:

Main files to migrate are:

  • /etc/passwd: It contains your password information.
  • /etc/shadow: it contains your encrypted passwords.
  • /etc/group: include your Group information on your system.
  • /etc/gshadow: It includes your group’s encrypted passwords.

These files can’t be copied from one system to another easily. To copy, you need to enter the following commands:

Source system

Apply the below commands , if you are migrating users From system:

mkdir ~/MOVE

The above mentioned command creates a directory to move all your files.

export UGIDLIMIT=500

The above mentioned command sets the UID filter limit to 500

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > ~/MOVE/passwd.mig

The above mentioned command will only copy user’s accounts.

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > ~/MOVE/group.mig

The above mentioned command copies the /etc/group file.

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > ~/MOVE/shadow.mig

The above mentioned command copies the /etc/shadow file.

cp /etc/gshadow ~/MOVE/gshadow.mig

The above mentioned command copies the /etc/gshadow file.

scp -r ~/MOVE/* USER@IP_OF_NEW_SERVER:/home/USER/

The Above mentioned command is used to move over the new server.

How to transfer files between Linux and Windows?

File transfer is very easy between Linux and Windows, and you can do that with the help of Putty. For better guldens, apply the below steps:

  • First of all, download and install Putty on your computer.
  • Now open the Command Prompt Terminal to change the directories to Putty-installation path.
  • Now replace the variable items with following command line

pscp.exe < LocalFilePath> <user> @<RemoteHost>:<RemoteDirectory>

  • After that, drag the file that you want to transfer and it will automatically populate the <LocalFilePath>

Comments

Leave You Comment