3

Is there a way to copy user list (with data and passwords) from one server to another.

We have two servers and one of those is new. I need to create same users (that exist in /home/) and set same passwords (if possible) sure /home/ dir will be copied also for the configs.

To be specific its Ubuntu server 10.04.1.

Linux <name> 2.6.18-238.5.1.iv.028stab085.3 <time> i686 GNU/Linux

JackLeo
  • 258
  • 2
  • 11

2 Answers2

6

These are the files you would usually need to copy:

/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
/home/$USER
/var/mail/$USER
/var/spool/cron/crontabs/$USER
JimB
  • 1,924
  • 12
  • 15
  • What about other users (www-data or ftp)? Won't the ID's mix up? – JackLeo Jun 01 '11 at 19:06
  • @JackLeo - if the servers are both Ubuntu, then the system accounts should all have the same IDs (if they didn't, upgrades wouldn't work). – JimB Jun 01 '11 at 20:19
0

You'll need to copy /etc/passwd, /etc/shadow and /etc/group along with the home directories

sreimer
  • 2,218
  • 15
  • 17
  • You forgot at least about mail spools and cron tabs. – AlexD Jun 01 '11 at 14:48
  • 1
    Also forgot gshadow. While group passwords are rarely used anymore, some tools will throw errors if group and gshadow are out of sync. – JimB Jun 01 '11 at 15:09