Ubuntu 13.04 x64
I have recently set up my PC with multiple users (my own account and 3 additional standard accounts)
As I have a habit of doing a fresh install every 6 months I always like to ensure my backup is up-to date (I am using the Deja-Dup backup tool)
Having never restored from a backup with multiple users before I would just like some clarity on how it will work or if indeed I am doing it correctly.
The folder I have backed up is /home as it contains the home folders of each user, so the question is when I do a fresh install (probably in October when 13.10 is released) and restore from backup will it create the additional user accounts, or will I first have to create the user accounts then restore. Or should I do a separate backup for each account or something completely different?
The user data base is not in /home. If you follow that approach, you will lose (or: mix up) the file ownerships. Each file and directory has a set of permissions, a user id (uid) and a group id (gid). Your backup tool saves all that, but it does not save the mapping from uid's to users and gid's to groups, since the involved number may be different on a fresh install. You will need to backup the files
/etc/passwd
,/etc/group
for those mappings. If you want to backup passwords (encrypted) you also need the file/etc/shadow
. However I would not just restore those files, but open them during restoring and use only the id's for recreating the users.This works flawlessly given that you have one user that has admin rights and has been the first user created on both the old and the fresh system (during installation) and given that you did not create other groups or added user to some groups. If that's not true, you'd have to have a closer look at the differences between the file version. But that is not hard to figure out, what'd need to be done.
What's nice to have are the encrypted passwords, which are in the
/etc/shadow
file. One example line:The long field between the
:
is the encrypted password. You can copy paste them to the new file. That way your users don't have to reset the passwords.Even if you lose all these files, you're not screwed. You can simply reassign the files in /home with the command
chown -R <user>: /home/<user>
. That may even be the preferred way.But all of this assumes, that your system is used the most simple way, i.e. there is no software installed that holds valuable configuration work outside /home, inside user's folders are just files of the respective user, there are no special group assignments (two user share file via a common group) and so forth---or all of that can be recreated easily.
If you have more complex user/groups and want to transfer file ownerships properly and you feel lucky you can do a stunt like ...
CONCLUSION:
Just backing up /home is perfectly fine for a desktop system if you know what you're doing/missing. Generally it is a good idea to test the desaster strategy!