When positioning a new web server, it becomes necessary to move the existing users of the old server to the new server. If the number of users are least, it can be added easily to your new server manually, but if the users are large in numbers like 100, 200, 500, etc… then manually migrating the users could become a very time consuming task. Luckily, a linux command “newusers” permits you to migrate multiple users in least time.

Usually, a new user can be created using the “adduser” command, whereas using the “newusers” command, you can add an entire file holding the users list. Create a plain text file (.txt) and include the info of a user per line as per the following format:

loginname:password:uid:gid:comment:home_dir:shell

For Example:

mac:abcxyz:1045:1021:Lazy Mac:/home/mac:/bin/bash

Same way, add multiple users info per line using the same format. To make this process more faster, you can use a spreadsheet or a simple database program in order to export the user list.

Once you are done with the text file, upload it to your new web server to secured directory. Lastly, run the following command as root in order to add the new users to your new server.

newusers batch-users.txt

That’s it ! You have successfully migrated the existing users to your new dedicated server in simply steps by using the “newusers” command.

Be Sociable, Share!

    About The Author