Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

To the point: After a fresh install, I cannot figure out how to assign users to existing folders on the /home partition.

The details: I upgraded from 10.04 to 12.04. I have 3 partitions:

/, swap, and /home. I formatted / and swap, while assigning /home while not formatting. The old folders and files are clearly there. The command ls -l /home in a terminal shows:

total 40
drwxr-xr-x 25 andy   andy    4096 Jul  4 08:46 andy
drwxr-xr-x 21 andy   andy    4096 Jun  5 18:52 andyl1
drwxr-xr-x 26 base   base    4096 Jul  4 08:52 base
drwxr-xr-x 29 base   base    4096 Jun  5 19:01 basel1
drwxr-xr-x 27 denise denise  4096 Jul  4 08:45 denise
drwxr-xr-x 18 denise denise  4096 Jun  5 18:56 denisel1
drwx------  2 root   root   16384 Feb 16  2012 lost+found

The users andyl1, denisel1 and basel1 are all from the old install (10.04). I would greatly appreciate any advice on how to assign the old folders. I'm not sure if the best/cleanest way is to assign the old folders to the new users, or delete the new users and try to mimic the older naming convention.

Additionally, I can follow general directions when given GUI guidance, how ever, I would appreciate very detailed instructions if I need to drop to a terminal.

Thank you

share|improve this question

2 Answers 2

I think all you need to do is edit the file /etc/passwd.

calligula:x:31415:20:Gaius Julius Caesar Augustus Germanicus:/home/callig:/bin/bash

The first collumn is the username. The next to last is the home directory which you can change at will. But one important thing is the number in the 3rd column which muust match the userid permissions of all the files in that directory. You can either change it there or reassign an entire home dir:

sudo chown -R 31415 /home/callig
share|improve this answer

You have a few options.

  1. As mentioned by @dargaud, you could modify the /etc/passwd file such that it no longer points to /home/andy but to /home/andyl1. PRO: easiest solution. CON: as you have updated the system, the new directories with default directory skeletons might contain configurations that work better with the current version. Furthermore, having home directory with a different name than your username is annyoing.
  2. Move /home/andy to /home/andy.tmp, then /home/andy1 to /home/andy. That way, you keep the new skeletons as a backup. CON: same as the first "CON" above. You can make it automatically:

    for dir in /home/*l1 ; do
      home=`basename $dir l1`
      mv "$home" "$home.backup"
      mv "$dir" "$home"
    done
    
  3. Try to identify the potential problems, and improve solution (2) such that you transfer some of the new configuration files to the new locations.

  4. Let the work to the users -- tell them to transfer the files they want to the new homes. PRO: less work for you and the configuration files are up to date. CON: more work for you if the users don't know what to do.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.