Backing up messages from KMail
David Fletcher
dave at thefletchers.net
Tue Sep 8 10:51:02 UTC 2009
Now, the reason for keeping the copy of /etc/?
Amongst other things, it contains the login IDs and passwords for all your
users!
I generally don't trust a backup strategy until I've successfully restored my
system from said backup. So, here goes:-
1) After your house burned down, you've built a new PC.
2) Install Kubuntu to the new machine, setting up just one user account - the
administrator. Login as the administrator.
A WORD OF CAUTION here - Linux labels accounts and the files and directories
owned by them with an integer number NOT the account name as text. If you
didn't have an administrator account before, you need to set this number high
enough not to clash with any user account. I can't remember how to set this
number at installation time - can somebody else help here please?
3) Take your most recent backup file (you did take a copy off site in case
your house burned down, didn't you?) and copy it into,
say, /home/administrator/recovery/
4) At this stage, you can unpack it by using Konqueror to navigate to the
backup file, right click it with the mouse, and select "Extract here". This
will unpack a copy of /home/ from the incinerated PC, but with rights to all
the files set to administrator, because at this stage it knows no better.
5) Look in your copy of /etc/ from the old machine (sorry I forgot to mention
changing this line of the backup script from /home/dave/ to something else to
suit your setup) and find these files:-
group
passwd
shadow
Open them with, say, kate and you will see that group contains details of the
group memberships of all your users, passwd many years ago used to hold
passwords in plain text, so I am told, but now it only contains a list of
users, shadow holds the passwords in what is called a hashed form to prevent
them being read.
6) Now open a konsole session, cd /etc/ and use a text editor (I like to use
joe for this) to restore your user accounts:-
sudo joe group
and restore the relevant entries from the recovered backup copy of the group
file to the new one.
Do the same with the passwd and shadow files.
Your new system now knows who's who!
7) Delete the copy of /home/ that you extracted by right-clicking from
Konqueror.
8) In the Konsole session, cd to the directory holding your backup file, and
extract it again, but this time using tar from the konsole to do it. Like I
said in the earlier posting, use man tar to see how to make it work.
This time, because we've restored the entries in the above three files, the
system knows who all the users are and tar can set the access rights and
ownerships of all the extracted files and directories. If you move into the
extracted /home/ directory with konqueror, I think you will find yourself
locked out of the users home directories.
9) Final step - use
sudo mv
to move each of the users recovered home directories into /home/ on the new
machine. That's it.
You should now be able to log out as administrator and log back in as
yourself, and find everything restored just like it was before.
Worked for me, a couple of months back when I moved from Gutsy to Hardy.
Hope I've not caused utter confusion.
I recommend that you try out this or a similar procedure for yourself on a
spare/experimental PC before you find yourself panicking because your hard
drive just crashed and you don't know how to recover your backup.
Set the option in kmail to "Leave mesages on the server" before you make your
backup otherwise the recovered account on the test machine will empty your
mailbox the first time you start up kmail.
I think that's all I've got to say on backup recovery procedure.
Dave
More information about the kubuntu-users
mailing list