Home directory on external drive
Solution 1
Sorry I disagree with the method you want to use and the proposed answer is far too difficult for something as simple as this.
You should not put /home/ on an external disk. You only put the user directories inside /home/$USER/ on an external disk. The system supports putting your user directories elsewhere with the file ~.config/users-dirs.dirs
. Perfect for this kind of setup. No need to mess with user-ids, UUIDs are anything else.
1 simple reason why you do not put /home/ on an external disk: There will be a problem in the future where the external disk does not mount and you will not be able to boot. Making it harder to fix you problems since you will need to fix it from a live session or grub rescue.
Keep /home/ next to your /. When the system does not find the external disk it will boot into an empty (blank) Desktop where /home/$USER/ is used as the base directory. But everything still works and you can use the desktop session to browse the web/AU for the problem you face.
And all you need to do is add both users to the same group and chown
the external disk to that group.
Mind also that the external disk MUST be ext if you want to put your /home/ on it. You can not use NTFS. When you use the method describe above you can use NTFS (the directories in /home/$USER/ do not require file permissions that /home/ must have to function).
Solution 2
As I said in the comments you need to
move both home directories to the external drive (see also step 3) and merge them there according to your liking (meaning: decide which file to keep if one exists in both original home directories),
configure both systems to mount the external drive at start-up (definitely use the file system label or UUID here!), and
-
assure that the user IDs of the users on the two system are identical – otherwise things become much more complicated. You can find out a user's ID with the
id -u
command (current user) orgetent passwd <USERNAME> | cut -d: -f3
(any user) orstat -c %u <PATH>
(owner of any file or directory).If the IDs differ and you administrate at least one of the systems you can change the ID of one or both users with:
sudo usermod --uid <NEW_UID> <USERNAME>
Incidentally
usermod
lets you change a user's home directory too in one command if you add the--home <NEW_HOMEDIR>
option. If you also add--move-home
it will move the files from the current to the new home directory.If you wand to be absolutely certain that the file ownership is correct you can run (on one machine since the directory is shared):
sudo chown -R <USERNAME_OR_ID> <NEW_HOME>
Related videos on Youtube
gorex
Updated on September 18, 2022Comments
-
gorex over 1 year
I have two (K)Ubuntu-computers in two different homes. I want them to share the user directory, however.
The optimum would be to have a local user profile on my hard drive and one on my external drive. Syncing the files via cloud or something completely different would also be okay if it is possible but not preferable though.
I tried to create a user with KUser whose home directory is located on the external drive but I was not able to log in. Using usermod -d is not working, too. The method mentioned by david förster did not allow me to log in using the desktop manager.
Thanks in advance :D
-
You'reAGitForNotUsingGit over 7 yearsPossible duplicate of Properly modify home dir
-
oldfred over 7 yearsI just copy /home and my /mnt/data where most of my data is to a flash drive. I also have list of installed apps. Then restore that on second computer. Used to have most data in a shared NTFS as back then laptop was XP. Then converted laptop to Ubuntu. Now just two desktops & two locations. I decided I did not need to cart laptop back & forth. Essentially my normal backup & restore.
-
gorex over 7 years@AndroidDev that didnt work out, so nope.
-
gorex over 7 years@olfred I would rather prefer an "automatic" method. But nonetheless thanks
-
gorex over 7 years@MarkWilliams yea, so weather it is possible
-
gorex over 7 years@DavidFoerster that actually did work but I am not able to log in using the desktop manager anymore and I didnt find a way to launch the plasma desktop after logging in, using the terminal.
-
David Foerster over 7 years@gorex: Rinzwind and I aren't entirely certain about an important detail of your question. Could you please review our discussion below his question and clarify your question? Thanks.
-
-
David Foerster over 7 yearsI don't think OP wants to move all user homes (i. e.
/home
) but only a single user home (i. e. that user's$HOME
). I agree that the former is way too complicated for novices to qualify as a good idea. -
Rinzwind over 7 yearsHe wants 2 users on different computers (so I assume 1 on each) to share a /home/
-
David Foerster over 7 yearsFrom where do you get that the question is about
/home
and everything underneath? The question says “I want them to share the user directory” (singular!). This is my only clue because every other mention of “home” or “homes” is unclear about whether it refers to/home
or a single user account's$HOME
and it's single counterpart on the other system. -
Rinzwind over 7 years"them" is not singular. "I have two (K)Ubuntu-computers in two different homes" is not singular. He wants to share 2 homes from 2 different computers using an external disk. Sorry I fail to see how this can be any discussion?!
-
gorex over 7 yearsThanks for the help I really appreciate it. I just want to have the files of one user on the external drive while the home-partition itself is located on the local drive, sry if that wasnt clear. I was able to change the mount point using the UUID and then moved the one particular user directory to the external drive using KUser, in which I actually succeeded. I just wasnt able to login trough the display manager of kde anymore. Logging in trough the terminal was possible though. What I did now was to create a completely new user directly on the external drive.
-
gorex over 7 yearsWith this user everything worked fine. Next time when I will be on my other computer I will change the external drives mount point on that one and make a new user with the same ID whose home folder will be the particular folder of the already created user on the external drive. So now I also have all the configuration files in sync what wouldnt be the case if I used Rinzwinds method (which seems much more uncomplicated though). Hope that makes any sense. Thanks for your help
-
nmgeek about 5 yearsSince when is /home required to boot a linux system? /home contains user directories which do not participate in the boot process. The root user's home directory is /root. (Some applications put stuff under a /home directory but not core linux applications.) I think this answer is just plain wrong.
-
Rinzwind about 5 years@nmgeek the system will recreate /home/$USER/ it it can't find it. Making TWO /home on the next boot when the partition is available. 1 will disappear and so will the content.
-
nmgeek about 5 years@Rinzwind I tested this on ubuntu 16 . I renamed /home to /oldhome and rebooted. 1. The system booted normally: that proves the assertion that it won't boot is wrong (for Ubuntu). 2. I was able to login with my password: the current directory became / since /home/me was not there. 3. It did create a new directory called /home but did not put any user directories under it. If mounting /home from an external share you would have already created /home as the mount point so nothing is wrong. It works. Your reasons for not putting /home on a remote mounted disk do not hold up.