is it possible to use Dèjà Dup to backup system files (not in /home/)?

Asked by Aldo "xoen" Giambelluca

Hi all, first thing thank you for this great tool, I like it a lot!

I've discovered Déjà Dup and I love it, it makes an important thing like having backups easy and then it can be used every day. Because I've also important files to backup outside /home/ I've started to use Déjà Dup in this way :

HOME BACKUP
I use the program in the classical way just escluding a directory with unimportant, big files.

SYSTEM BACKUP
I run deja-dup as root (sudo deja-dup). The directory to backup are:
* /etc/apache2
* /var/www
* /etc/mysql
* /var/lib/mysql
* /etc/apt
This directories contains the configuration files for Apache and Mysql, the data in database, the website for the web server apache and the configuration of apt.
The restore process is made as root too but I restore date in a temp directory before and after I move manually the directories (because it's not good to overwrite /etc/apt, especially if the restore is made in a different version of Ubuntu or in a different distribution, but this is a just detail).

So my question is, is this way of make system backup safe? All the permissions are preserved and restored? Can I use Déja Dup in this way or there is something I should know? In theory Déja Dup is "just" a front-end for duplicity and it should work but I prefer ask before I lose some bit :P.

Question information

Language:
English Edit question
Status:
Solved
For:
Déjà Dup Edit question
Assignee:
No assignee Edit question
Solved by:
Michael Terry
Solved:
Last query:
Last reply:
Revision history for this message
Best Michael Terry (mterry) said :
#1

Yes, this should be safe. Permissions should still be preserved and restored (with the proviso that it actually just preserves the uid/gid, so you have to make sure that those map to the same usernames/groupnames you expect on the restoring system).

You won't get the benefit of automatic backups (unless you normally log in as root, which is unlikely :)). If your backup files are all world-readable, you could drop the whole 'backup as root' thing and just backup as your normal user. When restoring, you can either put the files in a fresh directory (as you suggest) or will be prompted for root password to put them in their original locations.

Revision history for this message
Aldo "xoen" Giambelluca (xoen) said :
#2

So I could be in trouble if restoring from a LiveCD to another/new system since DD just preserves uid/gid.

Cool I can backup system things from user too :). But what if I try to backup some dir containing non-readable files/directories? Will DD warn me?

I disabled the automatic backup because I use an external drive not always mounted and I prefer decide when backup because I can stop using the computer and not modify nothing.

Thank you very mush for the answer :).

Revision history for this message
Aldo "xoen" Giambelluca (xoen) said :
#3

I've tried to copy the directories above using cp from normal user and I've received some read-error so it's better to make the "system" backup running deja-dup as root.

I'm thinking about the last sentence where you say "When restoring, you can either put the files in a fresh directory (as you suggest) or will be prompted for root password to put them in their original locations.".

I) If I restore the file in a fresh directory and after I copy that files I must use cp --archive to avoid files having root:root user/group, right?

II) I will be prompted for root password (in ubuntu this means your password I guess), I know here the problem is security vs. usability but what about prompt for the "root" password in the backup process too (if needed)? If user is in sudoers it is OK to read system files because he can do that anyway, in other distributions it will be prompted for the root password but if the user has that password is OK he can read all files.

Point II) is a little bit too "advanced" so probably is not a priority to implement in Déjà Dup but it's just an idea and plus it will not change the behaviour of the program for common users.

Revision history for this message
Aldo "xoen" Giambelluca (xoen) said :
#4

So I'm restoring from the LiveCD of Ubuntu 9.10 using Déjà Dup 10.2, I had the problem with the tmp directory (https://bugs.launchpad.net/deja-dup/+bug/332505) and used the workaround you suggested in comment and it seems to work.

The problem I have now is with the uid/gid, in my laptop my user has gid 1000, in the laptop I'm restoring the gid 1000 is used by the user of mu brother and my user has gid 1001, swap the gids in /etc/group is not a good idea I guess :P. So I have to change the gid of the restored files but what if some of my files has root owner? I need a script to change files/directories owner if gid=1000.

Revision history for this message
Aldo "xoen" Giambelluca (xoen) said :
#5

Thanks Michael Terry, that solved my question.

Revision history for this message
Aldo "xoen" Giambelluca (xoen) said :
#6

OK I've solved the uid/gid problem in this way, sure can help someone else. (Use these informations carefully).

In the laptop where I'm going to restore my backup there was 2 users, sergio with gid 1000 (the one of my brother) and xoen with gid 1001 (mine).

The first user is not so used and the home contain few files and there will be permission problems so I've changed the username/home/group of the user with gid 1000 and now it is the user xoen (here you can find all the command for change uid/username/groups/move home and so on, really a precious resouce! : http://www.cyberciti.biz/faq/howto-change-rename-user-name-id/ - See also the comment #3 from ubuntu).

Clean all the files in /home/xoen (rm -rf /home/xoen/.* too)

Now the user xoen has the uid 1000 and the permissions of restored files will be OK. I know change username/group and home to an existing user is not the easier of the things but in this case I preferred avoid change the uid/gid to a lot of files.