On 11/27/24 2:42 AM, -pj via openSUSE Users wrote:
On 11-27-2024 02:34AM, David C. Rankin wrote:
On 11/26/24 7:57 AM, Pit Suetterlin via openSUSE Users wrote:
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
I think you hit the nail on the head, but I'm not sure how to configure this? No files in my $HOME are indexed. The problem appears to be whoever plocate runs as, they do not have permission in my home directory:
drwx------ 48 david david 4096 Nov 26 23:47 .
In TW (and I presume in Leap), config is controlled by /etc/ updatedb.conf and the default does not specify and user:group it is running as (I always just presumed root, mlocate never had an issue). Maybe this is part of the "more secure" plocate features.
Looking at the systemd service file, it looks like it runs as a specific user with root group:
ExecStart=/bin/sh -c \ "chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && \ su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/ sbin/updatedb'"
Since my home has no group-read, the plocate user can't read it and there is no group read for root to read. I'll change perms to 0750 on my home and I bet it works. Will confirm after update.
Hi, my home directory here is very similar to yours permissions wise (I think it appears so). drwx------. 1 paul paul 1.3K Nov 25 11:47 paul locate does not have problems locating files in home it appears. locate .config does show .config files in home directory. I wrote to tell you about the permissions being similar.
Well... crap... that was it! Bad news is you must set home world-readable 0755 for plocate-updatdb to index your home. 0750 won't work. The process runs as user 'nobody', e.g. Nov 27 02:38:43 wizard systemd[1]: Starting Update the locate database... Nov 27 02:38:43 wizard su[184034]: (to nobody) root on none After setting home to 0755 and running the plocate-updatedb service, home is indexed and I can find my files: $ plocate doxygen | grep -i readme /home/david/dev/doc/c/doxygen/Readme_doxygen.txt /home/david/doc/linux/doxygen/Readme-doxygen.txt Hmm, seems I have two versions squirreled away :) No problem. I reset my home to 0700 and if I need to find a file plocate hasn't indexed yet, I'll just make home world-readable for the update and switch back after it is done. Only takes about 10 seconds with a SSD. Thank you for the help figuring this one out. I wasn't even thinking about permissions. It's always just worked. Now I have my "where did I put it" helper back -- and an easy procedure to update when needed. -- David C. Rankin, J.D.,P.E.