You are not logged in.
Hi, on one of the machines running archlinux, I have run into this problem. I can use "locate" command as root,
but not as a normal user.
$ locate uid
locate: can not stat () `/var/lib/mlocate/mlocate.db': Permission deniedAs a matter of fact, if I check the permission, I see
ls -l /var/lib/
...
drwxr-x--- 2 root locate 4096 14 déc. 2014 locate
...
drwxr-x--- 2 root locate 4096 18 déc. 11:51 mlocateAnd, the normal user account doesn't belong to the "locate" group. However, the situation is exactly same on the
other machine where the command works perfectly fine. Any idea on what is wrong?
(Edited after the comment of x33a)
Last edited by kde35 (2016-12-18 17:06:20)
Offline
I don't see the mlocate directory in your ls output. It says locate.
Offline
oops... I copy-pasted a wrong line. The post is now corrected.
Offline
Well I can't say why it works on your other machines, but as you can see here: https://git.archlinux.org/svntogit/pack … es/mlocate
It is specifically supposed to be accessible to only root and members of the locate group. So, just add your user to the locate group and it should work.
Offline
No idea about the actual cause for the setup, but "stat `which locate`" - it should be root:locate and have the suid bit set, ie. be "2755"
This explains why locate can access the file.
Offline
Well I can't say why it works on your other machines, but as you can see here: https://git.archlinux.org/svntogit/pack … es/mlocate
It is specifically supposed to be accessible to only root and members of the locate group. So, just add your user to the locate group and it should work.
Thank you very much. Well, I am sure that this should work and will work, but I would rather have a "clean" solution. That is, if I add another user tomorrow, then I still will remember that I will have to put him in the locate group, but if I add another user in several months, chances are that I won't remember it. So if you don't mind, I still don't consider the problem as solved.
Offline
Well, I am sure that this should work and will work, but I would rather have a "clean" solution. That is, if I add another user tomorrow, then I still will remember that I will have to put him in the locate group, but if I add another user in several months, chances are that I won't remember it.
But what would be the cleanest solution according to you? The mlocate database is accessible to all users in the `locate` group, so users need to be in the `locate` group in order to use the `locate` command. This seems pretty clean to me (in fact, it seems the cleanest to me). It's like adding users to the `wheel` group to give them permission to run `sudo`.
If you want all users to have access to the database by default, make the directory 755 (and probably the database file 644). Although pacman will complain about mismatching permissions on that directory, you will at least know why.
--edit--
Although, if the setgid bit is set on the executable, it should work for all users anyway, so the problem must lie somewhere else... I'm sorry for the noise.
Last edited by ayekat (2016-12-18 17:07:57)
Offline
No idea about the actual cause for the setup, but "stat `which locate`" - it should be root:locate and have the suid bit set, ie. be "2755"
This explains why locate can access the file.
Yes, I do get
ls -l /usr/bin/locate
-rwxr-sr-x 1 root locate 39520 14 déc. 2014 /usr/bin/locateSo, maybe I get the permission problem because suid is not working? This would explain why I have the other problem.
Offline
seth wrote:No idea about the actual cause for the setup, but "stat `which locate`" - it should be root:locate and have the suid bit set, ie. be "2755"
This explains why locate can access the file.Yes, I do get
ls -l /usr/bin/locate -rwxr-sr-x 1 root locate 39520 14 déc. 2014 /usr/bin/locateSo, maybe I get the permission problem because suid is not working? This would explain why I have the other problem.
As a matter of fact this was the case as I posted in the other thread. Thank you very much all.
Offline