View previous topic :: View next topic |
Author |
Message |
guyuming Apprentice
Joined: 19 Nov 2020 Posts: 236
|
Posted: Fri Apr 21, 2023 3:58 am Post subject: locate: can not stat () `/var/lib/mlocate/mlocate.db': Permi |
|
|
i think the sgid for /usr/bin/locate is correct, isn't it?
but i cannot run locate, i can only run locate with sudo.
what can be wrong? what kind of investigation or analysis i shall do next?
Code: |
guyuming@localhost ~ $ ls /usr/bin/locate -l
-rwxr-s--x 1 root locate 39456 Nov 2 14:14 /usr/bin/locate
guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate/mlocate.db
Password:
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 /var/lib/mlocate/mlocate.db
guyuming@localhost ~ $ locate xxxxxxxxxxxxxxxx
locate: can not stat () `/var/lib/mlocate/mlocate.db': Permission denied
guyuming@localhost ~ $ sudo locate xxxxxxxxxxxxxxxx
guyuming@localhost ~ $ |
|
|
Back to top |
|
|
sublogic Apprentice
Joined: 21 Mar 2022 Posts: 223 Location: Pennsylvania, USA
|
Posted: Fri Apr 21, 2023 4:20 am Post subject: |
|
|
I have Code: | sudo ls -l /var/lib/mlocate
total 15368
-rw-r----- 1 root locate 15732961 Apr 20 03:49 mlocate.db
$ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root locate 4096 Apr 20 03:49 /var/lib/mlocate | What are the permissions on your /var/lib/mlocate directory ? |
|
Back to top |
|
|
guyuming Apprentice
Joined: 19 Nov 2020 Posts: 236
|
Posted: Fri Apr 21, 2023 5:57 am Post subject: |
|
|
@sublogic
Code: |
guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate
total 31404
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 mlocate.db
guyuming@localhost ~ $ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root 998 4096 Apr 18 18:50 /var/lib/mlocate
guyuming@localhost ~ $ |
The 998 is strange, should be locate group. don't know why. But why is there a number? There is no 998 in /etc/group
Code: |
guyuming@localhost ~ $ cat /etc/group|grep locate
locate:x:245:
guyuming@localhost ~ $ cat /etc/group|grep 998
guyuming@localhost ~ $ |
I did not use the -d parameter for ls before. Thanks! |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1704
|
Posted: Fri Apr 21, 2023 12:36 pm Post subject: |
|
|
guyuming wrote: | Code: |
guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate
total 31404
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 mlocate.db
guyuming@localhost ~ $ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root 998 4096 Apr 18 18:50 /var/lib/mlocate
guyuming@localhost ~ $ |
The 998 is strange, should be locate group. don't know why. But why is there a number? There is no 998 in /etc/group |
All file systems record a UID number and not any name resolution. This makes it easy to store and transfer.
ls uses standard libraries to show a name if it exists.
So your solution likely is to fix the group permissions with chown or chgrp to something that is valid. |
|
Back to top |
|
|
|