<-Back

Users creation

If you have to move users from a server to an other server, think they must keep the same UID/GID. This can be very tricky. I remember the time when Linux went from first user as UID 500 to first user as UID 1000...

The simple way is to copy the /etc/passwd, group and shadow files. Honestly I never tried to do so. I have little users (never more than a handfull), so it's easy to re-create them by hand. One only have to write down the UID/GID before losing access to the old server.

You can also copy/paste the relevant part of the passwd and shadow files and the /home - this let the system "fake" users untouched. Be cautious!

Don't forget to copy also the /home of any user, else no log may happen.

Moving

This time, I have some more users. What I did is control the uid/gid didn't change between openSUSE versions, copy the user part of /etc/passwd from the old passwd file to the new one (not changing the system users), doing the same for /etc/shadow and copying the old /home to the new one with cp -a or rsync -a to keep the uid/gid. No problem so far. To this to works, you may have to do the rsync as root.

Of course you have to have a working /home, whether it is real mount point or symlink.

In the new server , do:

 rsync -av  root@xxx.org:/home/ /home/ 

The / after home mean: do not copy "home", but the home content.

to copy some contents (mailboxes, for example), better stop the relative service not to have locks.

And do think that as long as the move to the new server is not done, some files may change in the old one, so some rsync have to be done at the very end of the migration, after the old server is stopped and before the new is launched

The

 -n

option may be good to test the rsync line.

Data move

Same for data move, rsync the old data in the new folder. Eventually use a symlink on the new server if the place is not the same.

Some applications have data in special places. For example

  • mailman in /var/lib/mailman/
  • inn
  • postfix in /var/spool/postfix/
  • mysql in /var/lib/mysql