Hi Terry,

> > > On a new system, create users terry and terry2.  As terry2, alter
> > > /home/terry as you see fit.
>
> OK.  I now have a directory full of restored files and a new user.
> What is the best way of copying the restored files from the new user's
> login, to my current /home?

If the source and destination are on the same filesystem, then mv(1)
rather than cp(1) as it near instant.

You do not have the destination ‘current’ as that's earlier situation.
You remain logged in as terry2, and you're alter /home/terry which
isn't in use.

> 1.  Do the copy with sudo.
> 2.  Use a live disc and copy the files that way.

I'd expect it could be done as terry2 with sudo(8).

> Either way, I'm going to have to chown the new files to allow me to
> login and run the system normally.

Yes.  Don't over do it.  :-)  Here's a crib sheet.

I tend to first check my assumptions about what I'm changing are
correct.

Are all the restored files owned by terry2?
Print the first five that aren't.

    cd /home/terry2/terry-restore
    find ! -user terry2 -ls | sed 5q

Is their group as expected?  This might show up the odd file in group
‘games’, etc.  That's fine.  I'm just after confidence in the bulk.

    find ! -group terry2 ! -group users -ls | sed 5q

Change terry2 to terry, changing the symbolic links, not their
destination.

    sudo find -user  terry2 -exec chown -h terry {} +
    sudo find -group terry2 -exec chgrp -h terry {} +

Swap.

    cd /home/terry2
    sudo mv /home/terry /home/terry-2026-09-27

    sudo mv -i terry-restore /home/terry  # Same filesystem, or...
    sudo cp -a terry-restore /home/terry  # different one.

cp(1) also has an --update option which can be useful for later,
thoughtful cherry picking.

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2026-10-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
  New thread, don't hijack:  mailto:[email protected]

Reply via email to