LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backup only user created data (https://www.linuxquestions.org/questions/linux-newbie-8/backup-only-user-created-data-750917/)

thepalsrus 08-28-2009 01:00 PM

Backup only user created data
 
I am trying to figure out a way to backup any changes made by the user on a Ubuntu system.
I want to isolate the installed packages from the user data and backup only the user data.
The user may not have kept the files exclusively in the home directory and so I need to be able to find the changes and create a backup of just user created files.
I do not have a backup of the initial system installation and do not want to backup packages files.
The user is a python programmer and stores files in various locations outside the home directory.

I was thinking of trying to pull a list of all installed package files into a text file and excluding them during a backup. Is there an easier way to do this? Can I pull the list into the command without having to dump it to a file first?

Thanks

Tinkster 08-28-2009 01:07 PM

Hi, welcome to LQ!

If the user creates the files as himself (not using sudo/su
to get them everywhere) you should be able to just locate
them using his UID or name.

man find
/uid


Cheers,
Tink

thepalsrus 08-28-2009 01:28 PM

Wouldn't that give me all the files of the packages installed by that user as well? Is there anyway to find the ones he created even if he used sudo?

Tinkster 08-28-2009 01:33 PM

Quote:

Wouldn't that give me all the files of the packages installed by that user as well?
The "normal" way of package installations is via su/sudo mechanisms.
In either case the owner will be either root, or some system user (e.g.
apache or httpd).

Quote:

Is there anyway to find the ones he created even if he used sudo?
Short of the diff you already suggested: no.
You could go by time-stamps, but that's only valid for non-volatile
things (e.g., it wouldn't make sense for most files under /var).


Cheers,
Tink

thepalsrus 08-28-2009 01:54 PM

I am looking for a multi-platform solution. I was thinking about using the find command to find all the files used by that user, but it would not work since the user can use sudo to create files or install apps. I thought I could use:

for ENT in $(rpm -qa --filesbypkg | tr -s '[:blank:]' ' ' | sed 's:^[^ ]* ::' | sort -u); do if [ ! -d "${ENT}" ]; then echo "${ENT}" >> /tmp/rsync.exclude; fi; done

and them just exclude the files listed in the rsync.exclude file during backup. Is there an easier way to do this?


All times are GMT -5. The time now is 09:52 AM.