2

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 ~/Home/

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

  1. Changing the ~/.config/user-dirs.dirs to 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)
  2. Changing /etc/xdg/user-dirs.conf to enabled=False (which I believe just made it change to the default paths)
  3. Changing the /etc/xdg/user-dirs.defaults to 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??)
  4. Put the short veracrypt script at the beginning of /etc/xdg/user-dirs.conf to see if maybe xdg-user-dirs-update would pause its process to await the storage partition being decrypted and the terminal closed. (nothing)
  5. Running xdg-user-dirs-update after changing the values in ~/.config/user-dirs.dirs. (I believe that command is only run once during startup and all following executions are meaningless)

Update

Running 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.