raspberrypi / piserver

Raspberry Pi Server wizard to serve Raspbian to network booting Pis
308 stars 60 forks source link

how to port users/client machines from one PiServer to another #84

Open gbrickell opened 5 years ago

gbrickell commented 5 years ago

Hi - apologies if this is not the right area to post this, as it is a question rather an issue, but we have now reached a significant stage in the use of PiServer in an educational environment. For the last couple of years we have been using PiServer running on a laptop and setting up an ad hoc network when we run a club at the local School. The laptop/PiServer therefore now has a significant number of users and client machines configured on it.

But working with the School over the last few months we now have a dedicated VLAN in the School's network architecture and a new working machine/PiServer established in the School's machine room - which will allow us to deploy additional Pi's wherever they are needed throughout the School as well as the larger group of Pi's for the digital making club in the DT area.

So the question now is what is the best way to port the data from the existing laptop to the School's new machine?

Is it as simple as copying the /home folder as well as the /var/lib/piserver/os and /var/lib/piserver/tftproot folders ? or are there other config files somewhere that need to be copied across?

Ideally we would want to copy what is on the laptop, adding it to the various users/client machines that have already been set up on the new PiServer.

Your advice would be much appreciated so that we avoid any obvious mistakes!

Thanks

Geoff

maxnet commented 5 years ago

Ideally we would want to copy what is on the laptop, adding it to the various users/client machines that have already been set up on the new PiServer.

Merging users of multiple piserver installations is problematic. Unix users have numeric ID numbers, and if you have two users with both say number 1234, that is a problem...

Is it as simple as copying the /home folder as well as the /var/lib/piserver/os and /var/lib/piserver/tftproot folders ? or are there other config files somewhere that need to be copied across?

Dump the LDAP database which has information like username/password hash on the old server.

sudo slapcat > my-ldap-dump.ldif

If you already created users on both piserver installations and are really sure you want to merge users, you will need to open my-ldap-dump.ldif with text editor and edit the uidNumber field for each and every user, so that it has a number that is not already in use on the new server... (Perhaps just search and replace "uidNumber: " with "uidNumber: 999" to prefix the numbers?)

Then transfer the .ldif file to the new server, and import it there.

sudo slapadd -c < my-ldap-dump.ldif

When copying over /home make sure you use a method that keeps the userNAME information of each file. (and not the user ID number, if you are changing those). E.g. make a .tar file, and extract that on the new server. (Make sure the LDAP dump has been imported first, before you extract the .tar)