I currently have an encrypted (using Veracrypt) storage partition that I share between windows and ubuntu (that way I share the same files between operating systems and can backup all my files more easily). When decrypted, the storage partition contains the directories for "Desktop", "Pictures", "Documents", etc. (the user directories). To decrypt the partition, I have to enter my password, which I have done by creating a short script in ubuntu's "Startup Application Preferences" that launches a terminal, prompts me for the password, then decrypts and mounts the drive to
gnome-terminal -e 'bash -c "sudo veracrypt -t -k \"\" --protect-hidden=no --pim=0 /dev/sda5 $HOME/Home; exec bash"'
On windows, I set the user dirs to my storage partition directories and when windows boots, the desktop and other dirs are empty until I type in my veracrypt password and then all the user directories fill up with my files from the storage partition. I would like to have a similar effect on Ubuntu.
Things I Tried
- Changing the
~/.config/user-dirs.dirsto the paths of where my user directories are located after the storage partition is mounted. (I believe it is overwritten by xdg-user-dirs-update and just replaced with the home directory)
enabled=False(which I believe just made it change to the default paths)
- Changing the
/etc/xdg/user-dirs.defaultsto the paths of where my user directories are located after the storage partition is mounted. (Still just made it change to the default paths which is odd because isn't that the file for where the defaults are defined??)
- Put the short veracrypt script at the beginning of
/etc/xdg/user-dirs.confto see if maybe
xdg-user-dirs-updatewould pause its process to await the storage partition being decrypted and the terminal closed. (nothing)
xdg-user-dirs-updateafter changing the values in
~/.config/user-dirs.dirs. (I believe that command is only run once during startup and all following executions are meaningless)
mount --bind ~/old-dir/ ~/new-dir/ works for all the user directories EXCEPT for the desktop. The desktop directory is set to my storage partition and ~/Desktop/ brings me to my storage partition just as I wanted it to, however, the desktop itself does not update to display the files in my storage partition and instead shows the previous files. If I right click and create new folder, it creates a new folder in my storage partition and doesn't appear in the desktop. If there was some way to refresh the desktop to show the new mounted directory, that would be helpful.