Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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!
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.
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 :-)
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.
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 :-)
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.