[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On 07/02/2020 12:47, Neil wrote:
> I have already mentioned that my wife's laptop is playing up. It is
> coming up to 7 years old and has a spinning HD.
>
> I have my own laptop as a spare, which has an SSD and is working well.
> So I am considering setting her up as a second user on that computer
> while I decide what to do.
>
> I have not set up a second user for a long time, and I mean more than 15
> years, so I am a bit out of practice.
>
> I would set her up with her own password, and obviously copy over any
> files as necessary, including profiles. I would also like her to have
> root available, mainly for updates.
This is luckily for you a trivial operation. I'm presuming:
1: that both laptops run the same MX Linux distro
2: both have a "neil" account with sudo access
3: both have sshd running
4: your wife's home folder isn't huge
From experience if I remember rightly #3 is a bust for reasons I don't
understand or care about but it would make your life much easier if you
could just shunt the files straight over the network. Anyway...
On your current laptop open a shell and issue (change "wife" to
something more suitable obviously):
sudo useradd -m wife # creates user account and empty home folder
sudo passwd wife # sets password for new account
id wife #note the uuid number, probably 1000 or 1001
Go to misbehaving laptop (this is lame, you should be using ssh for all
these steps) and issue:
id wife # note the uuid again and compare it with previous uuid above
du -sh /home/wife # get size of wife's home folder for reference
Plug in a suitably large USB drive to misbehaving laptop. Create a
folder on it to hold the files for transfer (let's say it ends up being
/media/neil/USBDRIVE/transfer for example).
sudo rsync -aAHXSv --exclude={lost+found,.Trash*,System*} /home/wife
/media/neil/USBDRIVE/transfer
That command rsyncs the home folder to the transfer folder on the usb
drive. If it interrupts or breaks for any reason just run it again and
it will pick up where it left off. Unplug drive and plug it into the
working laptop.
sudo rsync -aAHXSv --exclude={lost+found,.Trash*,System*}
/media/neil/USBDRIVE/transfer/ /home/wife/
This command does the inverse and rsyncs the home folder from the USB
drive to the (empty) newly created wife account created earlier. When
you're adjusting these two commands to fit the file paths on your
machines be _very careful_ to pay attention to the trailing slashes:
note that the first does NOT have trailing slashes to both arguments,
the seconds DOES. This is not an accident: the first copies the
/home/wife folder entirely, the second syncs the _contents_ of that
folder to the contents of the target folder. The trailing slash omits
the parent directories from command two which is exactly what you want:
it's not a disaster if you get it wrong, you'll just have to tidy up the
mess afterwards manually. Run both commands with the optional argument
--dry-run first if you like and check what they're doing before doing it
for real. You're not doing anything destructive here though so don't
worry too much.
And you're done basically. To finish checking all is well, make sure
that the uuids from earlier for both wife accounts match up, that's very
important on any operating system (permissions). If they do, then you've
got nothing else to do except log in as the new wife account and make
sure all is well. If they do _not_ match you must fix it first:
sudo chown -R wife:wife /home/wife #recursively correct permissions
You probably set up both laptops with a neil account first I'd guess,
which will have automatically got uuid = 1000 on both of them. Your
wife's old laptop presumably has her as the second created user and she
will have uuid = 1001. As long as you don't have any other random user
accounts lying around on either it'll most likely work out that the
account names and uuids will luckily end up matching exactly which is
convenient. You must check this though and if for example your wife's
laptop doesn't have a neil account and her account has uuid = 1000 vs
1001 on the replacement machine you'll have to chown it as above.
If you had sshd running on both systems like a sane person this would
have been much much easier but that's on you. It would have been 4
commands issued in a row from just one of the computers and you could
have wandered off to watch TV for 30 minutes whilst you were waiting
¯\_(ツ)_/¯
Maybe this will be the thing that finally convinces you it might be
useful to have sshd running after all so there is that I suppose!
Not for the first time I've realised that after saying how easy and
trivial it is I've spent a lot of time explaining it and still left you
with some potentially dangerous variable substitution to deal with so
maybe it's not quite as trivial as I thought it was. It's sysadmin
trivial I suppose, perhaps not quite as user trivial as all that. As
ever, just ask if you get into problems - and if your wife's user
account ends up being bigger than your largest available USB drive
you're going to have to copy it over the network after all (which is
just a better idea full stop).
This is a slightly more advanced topic for another day but it's worth
pointing out that with ssh + rsync + cron it's simple* to setup a basic
replication scheme to sync user accounts between different computers on
a regular basis to guard against one laptop getting lost/broken/etc.
Well, *simple for some people I guess, not completely trivial obviously.
Good luck.
Alternatively, if you were continuously backing up the wife's laptop
somewhere you could skip most of that and just restore her home folder
from backup onto your laptop? Might be way easier.
--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dcglug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq