LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Backup User File (http://www.linuxquestions.org/questions/linux-general-1/backup-user-file-71445/)

cli_man 07-09-2003 10:30 PM

Backup User File
 
I have one quick question, I would like to know what I have to do to backup the usernames and passwords for my linux servers. I have all my servers doing a nightly backup of all the important data, the only thing I can't redo from my backups is putting in the usernames and passwords, do I just have to backup the user file and the shadow file? and how do I do that? Thanks

rch 07-10-2003 01:18 AM

just cp /etc/passwd <whereyouplaceyourbackup>/passwd.bak
and cp /etc/shadow
<whereyouplaceyourbackup>/shadow.bak
would suffice.
I don't think that there is need to compress and tar the files as they are very small.Just make sure that other users could not get them.
If you want you can use cron to backup the files daily.
Read the man pages for howto do that!

cli_man 07-10-2003 06:28 AM

Thanks, I thought that was what I needed to do, now my next question, say my server just blows up, hard drive is smoking, I do a compleate rebuild. When I copy those two files over and overwrite the ones that are there is that all I need to do to have my usernames there?

Oh and the cron stuff is not a problem, I already have all my backups running from cron every night, I just wanted to add my password files to my nightly backups.

ionstorm 07-10-2003 06:47 AM

Yep. You just copy them back over.

Are you sure you dont want to back up /etc/group too?

Ion

cli_man 07-10-2003 08:06 AM

Actually what I am thinking is that I should just be backing up the whole /etc directory, In the beginning I was only worried about the data but I am not sure I would want to have to redo all my configs if my servers blew up :-)

rch 07-10-2003 08:39 AM

I think that would be ok and it would also not take huge amount of space.But this time around you may have to compress(preferably bunzip2 even though it is slow and heavy on resources) and tar the files.
But I have never know any sysadmins backing up the whole /etc/ directory.They just backup the configs that are used regularly and they back up the configs once only every 1-2 months and they backup the /etc/passwd ,/etc/groups,/etc/shadow everyday coz they are being changed everyday.

cli_man 07-10-2003 08:57 AM

The way I have my servers set up is they run the smaller directories I want backed up through bunzip2 and put in a directory on the server. I then have my main data directory on the server shared out over nfs the nfs only exports to my main backup server, My backup server then pulls over all my data and the gzip file and does a tar.gz on them.

By doing it that way all the proccessor power is being used on my backup machine and not on my server so my server does not slow down during the backups. My backup server starts the backup on one server at 1:00am then the next at 2:00am and so forth, this has worked real nice for me thus far I am just trying to get my backups perfected :-)

rch 07-10-2003 09:10 AM

Quote:

Originally posted by cli_man
The way I have my servers set up is they run the smaller directories I want backed up through bunzip2 and put in a directory on the server. I then have my main data directory on the server shared out over nfs the nfs only exports to my main backup server, My backup server then pulls over all my data and the gzip file and does a tar.gz on them.
Since you are trying to perfect your backups I see 1 or 2 problems here,
1.Are you using bunzip2 and gunzip on the same files after they are tarred?
If it is then it would be pretty useless,as they use different algorithms.Bunzip2 is a block sorting algorthm and offers better compression than gzip(usually 30-40%).The real problems with bunzip2 is not only about resources(it basically eats up the CPU),but also that it can't be used for streaming(but maybe you don't require that feature).Next if you compress your data using bunzip2 they are compressed to the maximum,if you use gzip on them they can't possibly be compressed more.
2.I think you bunzip2 each of the files and then you send them to your server where it is tarred and gzipped if I understood it.Instead of that you could do send the bunzip2 files over the server and only tar them there.
Finally your ideas are definately ingenious.


All times are GMT -5. The time now is 11:03 AM.