2

I have a triple-boot system with Windows 10, Debian and Ubuntu.

At first I had only Windows 10 and Ubuntu. Then I installed Debian and I used the same home folder for both Debian and Ubuntu. It was mistake (see here for the drawbacks of doing a such thing: Different linux distros sharing the same /home folder?). And now I would like Debian to use its own home folder.

The output of sudo fdisk -l :

Disque /dev/sda : 698,7 GiB, 750156374016 octets, 1465149168 secteurs
Unités : sectors of 1 * 512 = 512 octets
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt

Device          Start        End   Sectors  Size Type
/dev/sda1        2048     616447    614400  300M EFI System
/dev/sda2      616448    2459647   1843200  900M Windows recovery environment
/dev/sda3     2459648    2721791    262144  128M Microsoft reserved
/dev/sda4     2721792  587857919 585136128  279G Microsoft basic data
/dev/sda5   587857920  588779519    921600  450M Windows recovery environment
/dev/sda6   588779520  661491711  72712192 34,7G Microsoft basic data
/dev/sda7  1410834432 1423183871  12349440  5,9G Linux swap
/dev/sda8  1423183872 1465147391  41963520   20G Windows recovery environment
/dev/sda9   731428864 1410834431 679405568  324G Linux filesystem
/dev/sda10  661491712  731428863  69937152 33,4G Linux filesystem

Partition table entries are not in disk order.
  • On sda6 is the root folder for Ubuntu
  • On sda10 is the root folder for Debian
  • On sda9 is the home partition.

What is the easiest way to have a fresh home directory for my Debian install? I don't mind if the home directory is located in the same partition as the Debian files.

Romain
  • 125

1 Answers1

2

In your case the disk seems to be full and your home directory is big enough; I would say there is no need for complicated procedures, and the best strategy is creating different home user directories between Debian and Ubuntu bellow home. As in /home/debian/userand /home/ubuntu/user.

To change the default base $HOME, both in Ubuntu and Debian, edit /etc/default/useradd and change home for:

HOME=/home/debian

or

HOME=/home/ubuntu

From now on, when you boot the respective OS, users with be created in the corresponding home directories.

For already existing users, the home directory has to be moved to corresponding home base directory. To do that in one go, both in the passwd file, and moving the directory, do:

usermod -m -d /path/to/new/home/dir userNameHere

For more details, see "Linux Change Default User Home Directory While Adding A New User"

You might also want to create users with different UIDs in the different directories if not wanting to have both users having access to the same files, as by default both systems will start adding users after 100; so again if it is to be different, edit /etc/adduser.conf and change in one of them:

FIRST_SYSTEM_UID=200 
FIRST_SYSTEM_GID=101

(I am giving examples, you might change your first uid if you have more than 100 users, or use another GID)

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232