I would like to reinstall debian on a new pc but keep the home partition. I know that during installation I can indicate the home partition but how do I manage the uid / gid of the home directories after the installation? If I create all the users I can't be sure they have the same uid/gid of the old system so the permissions of the home dir will result messed up.

What is the right way to proceed?

Maybe after installation can I copy /etc/passwd /etc/shadow from the old system to the new system?

1 Answer 1


After installation, copy the part of /etc/passwd and /etc/shadow that contains the user accounts, usually with numbers starting at 1000. Older systems may have used lower values, if that applies to your system then hopefully there is no overlap with the accounts created by the installation.

If you copy the whole file, you overwrite the system accounts below 1000, and that will likely cause problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .