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?

  • Not knowing BSD, I would see if there is a port of slocate or mlocate available, which hide files from users if they don't have permission to view them. Jul 24, 2019 at 0:29
  • @AaronD.Marasco Thanks, but neither of those are bundled with FreeBSD 12, and neither are found in the Packages tree. This Answer suggests using find as a secure but slower alternative to locate. Jul 24, 2019 at 3:38
  • 3
    You could run sudo periodic weekly to build/rebuild the locate database safely .
    – fd0
    Jul 24, 2019 at 10:51
  • @fd0 Thanks for that valuable info! I added that as an Answer on my other related Question. Jul 25, 2019 at 18:25

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .