FreeBSD – How to Delete the ‘Locate’ Database in FreeBSD

freebsdlocateSecurity

After having established the locate command's database indexing file & directory names across my FreeBSD 12 system (as described in this related Question), I now regret doing so because of its emitted security warning:

Executing updatedb as root. This WILL reveal all filenames on your machine to all login users, which is a security risk.

➥ Is there a way to undo the effects of running sudo /usr/libexec/locate.updatedb?

Best Answer

The only thing that locate.updatedb does is update the locate database.

If you don't want to divulge the locations of sensitive files via that database, then you can wait for locate.updatedb to complete, and then run the rm command to remove the database:

sudo rm /var/db/locate.database