D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Wife's computer


On 08/02/2020 09:19, Neil wrote:
> Answers. 1. Yes, both have MX 19
>       2. My user name on my lap is         neilwin. My wife's user name 
> is pam
> 3. Don't use SSH (shock, horror)
> 4  Very few files.
> You have given me a lot of help and instructions for this. However, what 
> I plan is to copy some of her folders on to an external HD. Mainly 
> documents and pictures. I will also copy any profiles, in hidden files.
> Then, once I have  set her up as a second user, I will copy the contents 
> of these folders over. Email is not a problem as we use IMAP on my own 
> web site.
> I hope that will work,

It will partly work but you'll run into a whole bunch of problems you 
weren't expecting, which is exactly what these instructions take care 
of! Bear in mind this is exactly the sort of thing I'm paid to do all 
day every day so I didn't pull this methodology out of my ass, this is 
"The Linux Way" of doing things. You're obviously using Linux and are 
going to spend far more time wondering why things aren't working 
properly and trying and failing to fix them afterwards if you just 
blindly start dumping random files manually back and forth on USB. Your 
call my friend ¯\_(ツ)_/¯

The "proper" method uses rsync because it's literally what rsync is for. 
My method - which isn't my method, it's _the method_ - has already 
accounted for all of the things you haven't yet realised yet are going 
to be a problem. Permissions particularly, unless you're lucky and the 
account UUIDs match up, are going to mess you up immediately. What you 
might not have realised is that by properly rsyncing the home folder 
like this onto the stand-in laptop is that it's not just copying some 
random pics and documents over: it's literally cloning the entire 
account and everything in it. Your wife will thank you when she can sit 
down in front of it, login for the first time and her old account will 
be there in it's entirely complete with _all_ the data, settings, tweaks 
and adjustments. Even her wallpaper and position of desktop icons will 
be the same.

I probably should have made that clearer actually - come to think of it 
you were probably looking at the list of instructions and wondering how 
copying a few files between laptops could be so complicated? This isn't 
a naive file copy, it's a Linux account > Linux account transfer between 
machines. Perhaps that makes more sense.

For the record, if you were wise enough to have sshd available (you do 
know like any Linux service it can be toggled on/off quickly as you need 
it right?) the _entire_ process would be over and done with in about 3 
minutes. This is what it would look like if I were doing it:

[sat on your laptop logged in as neil]

sudo useradd -m /home/pam && sudo passwd pam
id -u pam && ssh pam@pamlaptop 'id -u pam'
rsync -aAHXSv --exclude={lost+found,.Trash*,System*} 
pam@pamlaptop:/home/pam/ /home/pam/

That's it. Line 2 prints the uuids for user pam on both machines so you 
can check they match: if they don't, the final step is:

sudo chown -R pam:pam /home/pam

The longest bit by far would be waiting for rsync to pull the files 
over, after which you'll have a perfectly synchronised copy of Pam's 
account sat ready for login on your machine. Note the use of ssh as the 
indispensable "glue" layer that enables seamless issuing of commands 
between machines - it's also the transport layer that rsnyc runs 
through. By switching the order of a couple of the commands exactly the 
same process could be done from the other laptop as well - normally I'm 
somewhere else entirely (frequently not even in the same country 
although that's hardly relevant any more with the internet) on a third 
machine when I'm doing basic user maintenance stuff like this.

Why don't you give it a spin? You never know, you might even have a 
lightbulb moment where you realise that ssh isn't some obscure and scary 
sysadmin tool.
The Mailing List for the Devon & Cornwall LUG
FAQ: http://www.dcglug.org.uk/listfaq