[clue] [HelpDesk] move/copy user to another machine

Yaverot Yaverot at computermail.net
Thu Jun 9 16:50:21 MDT 2011


Thanks to David L. Anselmi and Shawn Perry.
Finally got this done, I need to stop putting furniture in front of the only 3 prong outlets in the room...

Anyone who doesn't want the near blow-by-blow should probably hit delete now.


I figured I'd reply so that if someone sees this in an archive they can know how well it works, with my problems.

I collected the information:
Gentoo has everyone as part of "users" instead of each user in own group like Ubuntu (both cases defaults of the time for that distro).
I got the appropriate lines from /etc/{passwd,shadow,groups,gshadow} off of Ubuntu and copied into a holding file on Gentoo.
The old user numbers were already in use on the target system.
I also verified that the running Thunderbird under Ubuntu is the one in the stable tree in Gentoo.* 

After collecting that information, I went ahead and did an adduser under Gentoo to have it prepopulate correctly.

Problem 1: ssh-server is not installed on Ubuntu (I may have uninstalled it for space and security) Solution (re)install it.
This also taught me that rsync uses ssh. Cool!

Problem 2: after sshd being up and running rsync fails because I don't have target user's password.  Solution: change user's password, I already have it backed up for the transfer process.

Problem 3: rsync ran successfully, into the wrong directory.
Not:
rsync -avPihhH --delete-before --stats <username>@<oldhost>://home/<username> /home/<username>
but: 
rsync -avPihhH --delete-before --stats <username>@<oldhost>://home/<username>/ /home/<username>

That extra "/" anchors it correctly.  
Also, I never figured out what the "-hh" option does. I'm assuming "human readable"

Problem 3:
chmod -Rc <username>:user /home/<username>
doesn't work. First switch it to users instead of user, nope. Being so close to the correct answer it took awhile for me to figure out.
chown -Rc <username>:users /home/<username>


Cool, so it should ideally be all done.  Attempt to login, I forget the exact wording of the error message, but it pointed me in the wrong direction.  Recognizing it as some sort of Xorg/Gnome problem, I had to fix the following two files:
.xinintrc
.dmrc
I experimented with a couple other fixes first, so there may be another file to watch out for if anyone follows this.

Get a correct login. *Realize I hadn't installed Thunderbird on target system yet...

After getting thunderbird in, and checking it works, use the stored /etc/shadow line to put the user's password correct.

Disconnect everything, and put the new system where the old one was.

So there's one minor problem with the user's account left, and two things to do for the system.
User: It stacks the icons on top of each other on the desktop, and redoes this each time he logs in. What makes this worse is that "recycle bin" is in the stack.
Any hints appreciated.

System:
Need to setup CUPS for printing, and some type of flash for youtube.  I'm assuming the base directions http://www.gentoo.org/doc/en/printing-howto.xml are good, and that problems will Google-away quickly.

In summary, this shows I have a weird level of competencies for Linux.  Not knowing that rsync uses ssh silently, but getting .xinitrc relatively quickly. 

--- shawn at redmop.com wrote:
From: Shawn Perry <shawn at redmop.com>


On Mon, May 30, 2011 at 3:40 PM, David L. Anselmi <anselmi at anselmi.us>wrote:

> Yaverot wrote:
> > I want to move one (or two, but less than 5) user account from a Ubuntu
> >Linux (not yet 10.10 version) to a Gentoo box.  The Ubuntu system is low 
> >RAM, and have very low hard drive space remaining.

> On Gentoo, create accounts for the users you want to move.  Use those
> accounts to copy all the files
> in the home directories to Gentoo.  I'd use rsync.  Do you need more detail
> on those steps?

> There are two things you need: the entry in /etc/{passwd,shadow}, the files
> in the home directory.

And the entries in /etc/gshadow and /etc/group as well


> You can't copy the /etc/passwd entry between machines unless the UID is
> unused on Gentoo.  If it
> isn't used then copying that line and making an empty home dir would be
> easy.  You can copy the
> password hash between shadow files but that isn't easier than just
> re-entering it.

You can copy the passwd entries as long as you change the UID to something
that isn't used on Gentoo (the new box).  Don't forget /etc/group as well.


> Normally when a new account is created some files will be put in $HOME.
>  Probably you don't care about overwriting them with the files from the 
> Ubuntu system but if you have different desktops some
> of the files might conflict or be unneeded.  Likewise if your Thunderbird
> versions are very different.

on the new machine, run the following (read them ALL before running any of
them)

rsync -avPihhH --delete-before --stats
<username>@<oldhost>://home/<username> /home/<username> --dry-run # vPihh
and --stats are optional, remove --dry-run after you're sure you have
everything right.
chmod -Rc <username>:<username> /home/<username> # if the users are
primarily members of their own groups
chmod -Rc <username>:user /home/<username> # if the users are primarily
members of the user group




More information about the clue mailing list