Since Ubuntu lucid, locate excludes files in ecryptfs filesystems, although it still indexes the encrypted filenames (which is pretty useless). Edit /etc/updatedb.conf, add the ecryptfs paths to PRUNEPATHS, and ensure that PRUNEFS includes ecryptfs.

This is a modified copy of /etc/cron.daily/updatedb. It indexes only $HOME, and stores the resulting database in ~/.mlocate/. Like the system cron updatedb script, my script won’t run when on battery power, and it uses ionice to minimise impact on the user.

Now, edit your user crontab and add a line to run this script.

crontab -e

The following line runs hourly, and doesn’t run when my home directory is encrypted.

1

2

# m h dom mon dow command

47****[-x$HOME/.mlocate/updatedb]&&$HOME/.mlocate/updatedb2>/dev/null

Force the new script to run, or wait an hour.

$HOME/.mlocate/updatedb

Finally, add the new database to the LOCATE_PATH environment variable. This specifies additional locate databases to search, so you’ll still have access to the system locate. Put the following line in .bashrc or anywhere that your shell will source.

1

export LOCATE_PATH="$HOME/.mlocate/mlocate.db"

You now have a personal locate database securely stored in your encrypted home directory.

It’s good to consider that possibility anyway (stale lockfiles), but so far I’ve not had a problem with one. Also, this script is just a modification of the Debian/Ubuntu mlocate one. If it works for the system …

you are actually a good webmaster. The web site
loading pace is amazing. It sort of feels that
you are doing any distinctive trick. Also, The contents
are masterpiece. you have performed a fantastic process
in this topic!