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. – Aaron D. Marasco Jul 24 '19 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. – Basil Bourque Jul 24 '19 at 3:38
  • 3
    You could run sudo periodic weekly to build/rebuild the locate database safely . – fd0 Jul 24 '19 at 10:51
  • @fd0 Thanks for that valuable info! I added that as an Answer on my other related Question. – Basil Bourque Jul 25 '19 at 18:25

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.