[Solved] Changing the default location for /Home folders?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Mattyboy
Level 6
Level 6
Posts: 1193
Joined: Thu Mar 26, 2015 2:17 pm

[Solved] Changing the default location for /Home folders?

Post by Mattyboy »

Code: Select all

System:    Host: mintman-To-be-filled-by-O-E-M Kernel: 4.13.0-43-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3) Distro: Linux Mint 18.3 Sylvia
Is there/where is a config file for changing the default location for /Home folders?

I want to default link /home/mintman/Downloads to a separate partition. I know you can set individual locations on a program by program basis, qbittorent for example. There must be a better way of doing it rather than a symbolic link. I plan on encrypting /Home so will be fstab-ing the partition to auto mount on boot.

I'm sure this is easy just don't know/can't remember where to look :lol:

Cheers.
Last edited by Mattyboy on Tue May 29, 2018 2:26 pm, edited 1 time in total.
acerimusdux
Level 4
Level 4
Posts: 343
Joined: Sat Dec 26, 2009 3:36 pm

Re: Changing the default location for /Home folders?

Post by acerimusdux »

If you put it in the fstab, you won't need to do anything else (once you reboot). The line added to your /etc/fstab will look something like this:

UUID=#### /home/mintman/Downloads ext4 errors=remount-ro 0 2

The #### above replaced by the UUID of the partition (foud using blkid command). At boot, that will just show up at /home/mintman/Downloads.

If you have anything else there, you won't be able to access it while that folder is being used as a mount point. So move everything over to the new partition, first.

edit: ahh, but I didn't account for the encryption. That makes it a little more complicated. I think you have to create the encrypted partition named "downloads" first, and then the fstab looks something like:

/dev/mapper/downloads /home/mintman/Downloads ext4 defaults 0 2
User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: Changing the default location for /Home folders?

Post by Sir Charles »

I think you could change the default path to any of the directories in ~/ by editing the corresponding line in~/.config/user-dirs.dirs.

Let say if you mount the partition at/media/Downloadsthen you would need to change XDG_DOWNLOAD_DIR="$HOME/Downloads" to XDG_DOWNLOAD_DIR="/media/Downloads".

Or simply run:xdg-user-dirs-update --set XDG_DOWNLOAD_DIR="/media/Downloads"

Either way, log out and log back in to make the changes effective or run xdg-user-dirs-update to make it effective immediately.
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.
Mattyboy
Level 6
Level 6
Posts: 1193
Joined: Thu Mar 26, 2015 2:17 pm

Re: Changing the default location for /Home folders?

Post by Mattyboy »

acerimusdux wrote:
Tue May 29, 2018 5:46 am

edit: ahh, but I didn't account for the encryption. That makes it a little more complicated.
Yeah, I'm thinking link /Downloads to the partition mounted in /mnt as I'm not encrypting /root.

I kinda want to make the /Downloads folder a "default" symbolic link to /mnt without making one inside the /Downloads folder then having to go through the pain of pointing all the programs to it..... if you're following me :lol:

EDIT:
Marziano wrote:
Tue May 29, 2018 6:31 am
I think you could change the default path to any of the directories in ~/ by editing the corresponding line in~/.config/user-dirs.dirs.

Let say if you mount the partition at/media/Downloadsthen you would need to change XDG_DOWNLOAD_DIR="$HOME/Downloads" to XDG_DOWNLOAD_DIR="/media/Downloads".

Or simply run:xdg-user-dirs-update --set XDG_DOWNLOAD_DIR="/media/Downloads"

Either way, log out and log back in to make the changes effective or run xdg-user-dirs-update to make it effective immediately.
Ahh, yeah, that's more along the lines of what I was thinking... I'll have a play later tonight and let you know how I got on... Cheers!
User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: Changing the default location for /Home folders?

Post by Sir Charles »

Hope it works, good luck!
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.
Mute Ant
Level 14
Level 14
Posts: 5131
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: Changing the default location for /Home folders?

Post by Mute Ant »

Neo says: "Do not try and bend the spoon. That's impossible. Instead, only realize the truth..." There is no /Home folder.
Unless you want people to just guess?
Rik says: "Do it properly and don't skip bits!"
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".
Mattyboy
Level 6
Level 6
Posts: 1193
Joined: Thu Mar 26, 2015 2:17 pm

Re: Changing the default location for /Home folders?

Post by Mattyboy »

Marziano wrote:
Tue May 29, 2018 6:43 am
Yup worked a treat. I just made an fstab auto mount and edited the config.

Code: Select all

mintman@mintman-To-be-filled-by-O-E-M ~ $ cat ~/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="/mnt/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
Sorted, no spoon required :lol:
Thanks all.. solved ( knew it was easy :lol: )
User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: [Solved] Changing the default location for /Home folders?

Post by Sir Charles »

That's great! :D it worked.
Easy, wasn't it? :lol:
Cheers
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.
Post Reply

Return to “Newbie Questions”