The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question about 'locate'

Discussion in 'General Discussion' started by kcdworks, Jul 5, 2003.

  1. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    When trying to run locate as a wheel user, I get this error:

    kcdworks@decrypted [~]# locate something
    warning: locate: could not open database: /var/lib/slocate/slocate.db: Permission denied
    warning: You need to run the 'updatedb' command (as root) to create the database.

    I have run updatedb as root, and it completed. Root has no problem running the locate command, but my wheel users (and regular users) still cannot.

    Any suggestions?

    cPanel.net Support Ticket Number:
     
  2. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    What are the ownership/permissions on /var/lib/slocate/slocate.db ?

    cPanel.net Support Ticket Number:
     
  3. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    They were 0600 ... I changed them to 0644 with no luck.

    cPanel.net Support Ticket Number:
     
  4. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    hhmm...I kind of skipped over the command you issued before. Try using slocate instead. Perms should be 640.

    cPanel.net Support Ticket Number:
     
  5. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    You may also want to check the perms on the binary. Most systems since locate was replaced with slocate; there should be a symlink in place. So check the permissions on /usr/bin/slocate; if you want your users to use the binary; chmod 755 /usr/bin/slocate

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  6. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    There is a symlink in place. I'll try changing the permissions now.

    Unfortunately, that did not work either. The error still appears.

    cPanel.net Support Ticket Number:
     
  7. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    You probably have to change the permissions on the parent directory as well. I kind of thought that went without saying. chmod 755 /var/lib/slocate

    cPanel.net Support Ticket Number:
     
  8. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    It did go without saying.

    I did that when I made the initial changes, and am still getting the error.

    cPanel.net Support Ticket Number:
     
  9. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Well it can only be one thing then:

    chmod 644 /var/lib/slocate/slocate.db

    cPanel.net Support Ticket Number:
     
  10. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    Look up ... I already tried 0644, then I tried 755 as you suggested.

    Either allow ROOT to be able to execute locate or slocate, but neither allow any other users to execute it.

    cPanel.net Support Ticket Number:
     
  11. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    I logged out, then logged back in, having made NO CHANGES since my last post, and I'm now able to execute locate and slocate.

    This keeps getting stranger and stranger.

    cPanel.net Support Ticket Number:
     
  12. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Here's what needs to be done to have any user use slocate:

    chmod 755 /var/lib/slocate/
    chmod 644 /var/lib/slocate/slocate.db

    cPanel.net Support Ticket Number:
     
  13. kcdworks

    kcdworks Well-Known Member

    Joined:
    Jul 28, 2002
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    Thanks, I appreciate your help.

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page