<SOLVED> 'locate' command finds files only in root

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
brianshel
Level 1
Level 1
Posts: 10
Joined: Tue Jul 14, 2009 7:46 am
Location: UK

<SOLVED> 'locate' command finds files only in root

Post by brianshel »

Laptop with Mint 19.2 Mate and encrypted home directory. I know about 'sudo updatedb' and how it refreshes the file database, but when searching for file(s) I am finding that the only ones listed are in root. Everything in 'home' is ignored. Is this caused in some way by the encrypted home directory? The reason I suspect this is that the same Mint 19.2 Mate installed on my desktop pc where the 'home' directory is NOT encrypted works as expected. In case it is relevant here is inxi -Fxxxrz.
Samsung_details.txt
(4.42 KiB) Downloaded 3 times
Last edited by brianshel on Sun Apr 12, 2020 10:50 am, edited 1 time in total.

User avatar
powerwagon75
Level 4
Level 4
Posts: 275
Joined: Sun Feb 28, 2016 4:05 pm
Location: USA

Re: 'locate' command finds files only in root

Post by powerwagon75 »

You are correct, it is a security measure, and the encrypted items are pruned out in your /etc/updatedb.conf file.

snippet from updatedb.conf:

Code: Select all

 ... 
 PRUNEPATHS="/tmp /var/spool /media /home/.ecryptfs /var/lib/schroot"
 ...
Image
Custom tower w/Mint 18
HP laptop w/Mint 18
Acer w/W10/Mint 18.3
Macbook w/El Capitan/Mint 18.3
Optiplex 960 "Frankenbox" w/Fedora 30/Mint 18.3/Mint 19.2
Acer C720 Chromebook w/GalliumOS
Mac PPC G4 w/Lubuntu

brianshel
Level 1
Level 1
Posts: 10
Joined: Tue Jul 14, 2009 7:46 am
Location: UK

Re: <SOLVED> 'locate' command finds files only in root

Post by brianshel »

Your reply was useful and pointed me in the right direction.

By looking at the output of 'sudo updatedb --debug-pruning' I was able to see that the 'ecryptfs' file system was being excluded, thereby 'locate' would not list any files in my 'home' directory. Therefore I edited /etc/updatedb by deleting 'ecryptfs' from the line commencing PRUNEFS. 'locate' now works as expected.

As for security, I can see that there is a theoretical risk in that file names in the encrypted 'home' directory could be visible to an unauthorised user. However it would not allow access to such a file, so I can live with that. Also I am the only user of my laptop. I think ideally it would be good if one could change the location of the default database to somewhere within the 'home' directory (say ~/.config/mlocate/mlocate.db instead of /var/lib/mlocate/mlocate.db), but I can see no way of doing that as a default.

Thank you for your help which is much appreciated.

Post Reply

Return to “Software & Applications”