Skip to main content

Copying Linux users and passwords to a new server [Resolved]

I am migrating over a server to new hardware. A part of the system will be rebuild. What files and directories are needed to copy so that usernames, passwords, groups, file ownership and file permissions stay in intact?

Ubuntu 12.04 LTS.

Question Credit: Mikko Ohtamaa
Question Reference
Asked October 11, 2017
Tags: linux, passwd
Posted Under: Network
3 Answers

Be careful that you don't delete or renumber system accounts when copying over the files mentioned in the other answers. System services don't usually have fixed user ids, and if you've installed the packages in a different order to the original machine (which is very likely if it was long-lived), then they'll end up in a different order. I tend to copy those files to somewhere like /root/saved-from-old-system and hand-edit them in order to just copy the non-system accounts. (There's probably a tool for this, but I don't tend to copy systems like this often enough to warrant investigating one.)

credit: Paul Gear
Answered October 11, 2017
Your Answer