How to properly re-establish users after a reinstall?

Craig White craigwhite at azapple.com
Mon Apr 20 19:29:39 MST 2009


On Mon, 2009-04-20 at 18:40 -0700, Josef Lowder wrote:
> A question about how to properly re-establish the two users that I had
> prior to reinstalling my Linux operating system (only the OS in the
> "/" partition)?
> 
> I had to reinstall because when I tried to install Virtual Box, it
> screwed up my system and caused "X" to no longer work. I could get to
> the command line, but could not startx.
> 
> So, I used the live CD that I had initially used to re-install just
> the "/" portion that I had previously installed on /dev/hda5, and I
> reformatted only that "/" partition but I *did not* reformat the
> "/home" partition that was on /dev/hda7.
> 
> In my original installation, I had created two users: /home/joe and /home/patti.
> 
> The reinstall process required a user other than root to be created,
> so I created user "patti" (because she had nothing crucial to be
> protect), but I did not create a new user "joe."
> 
> The reinstallation went fine and "X" was restored; and when I examined
> the results from the command line, I found all of my original user
> files were preserved (curiously in /home/joe/joe) even though I did
> not create a new user "joe."
> 
> But here's the confusion: I now have two "patti" directories.
> One in /home/patti and another in /home/joe/patti.
> 
> $ df shows the following file system:
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/hda5             3.9G  875M  2.8G  24% /
> /dev/hda1              10G  4.3G  5.8G  43% /mnt/win_c
> /dev/hda7             7.7G  1.6G  6.2G  20% /home/joe
> 
> So, my question is, can I just move /home/joe/patti to /home/patti?
> And then create a new user "joe" and move the old /home/joe/joe to
> /home/joe?
> 
> Or is there something different I need to do to make sure that I don't
> create problems?
> 
> FWIW, I uploaded a survey of the newly reinstalled system's files at
> this link: http://www.upquick.com/view/t40.pdf
> 
----
it appears that you have mounted /dev/hda7 as /home/joe rather than
just /home

if you haven't created anything else (i.e., users, in /home, you could
probably just change the mount point in /etc/fstab and
'umount /home/joe' and 'mount -a' and everything would be fixed. You
would of course want users named joe and patti and if you haven't
already created them, you could figure out which uid number they had
previously...

ls -ldn /home/joe/*

and their user & group numbers from your old system should be displayed.

Then you could create them again with a 'useradd' command like, 

useradd -u 501(or ??) -g 501(or ??)

type 'useradd --help' for information.

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the PLUG-discuss mailing list