I selected /home/ to be encrypted when I was installing Ubuntu. Now, is it possible to make
locate work with an encrypted partition like this?
I both "run locate (updatedb) when I'm logged in", as mentioned above, and I keep my part of the locate database under my encrypted $HOME.
and then I index the files in
updatedb -l 0 -o $HOME/var/mlocate.db -U $HOME
Now I have a complete index of
$HOME but the database isn't visible unless
$HOME is mounted and decrypted.
How about running updatedb when your file system is decrypted and try to match environment variables to read/write it?
After reading the man page, add two variables to your BASH RC file.
man locate echo "export LOCATE_PATH=$HOME/var/lib/mlocate/mlocate.db:$LOCATE_PATH" >> ~/.bashrc echo "export DBPATH=$HOME/var/lib/mlocate/mlocate.db:$DBPATH" >> ~/.bashrc
Make the directory specified above and add $username to the mlocate group.
mkdir -p ~/var/lib/mlocate/ sudo usermod -a -G mlocate $username
Log out and in again to count your user in the mlocate group and get the new environment variables. Now when you run,
updatedb -o $LOCATE_PATH
are the decrypted files in a locate database now? Or, what did you do to make it work or better?
You may also want to add updatedb to user's crontab. First run:
And add the following line:
0 12 * * * updatedb -o $HOME/var/locate