Announcement

Collapse
No announcement yet.

Locate is not available to user

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Locate is not available to user

    I've been using linux for years, but have never seen this problem:
    When I attempt to run 'locate' use, I get the following:
    locate: fatal error: Could not find user database '/var/lib/slocate/slocate.db': Permission denied
    Works fine if I sudo.
    I have played with the ownership and chmod, but I can see that when
    updatedb is run the following ownership is set:
    root:slocate
    and permissions are set to 644, but regardless of what I set,
    I keep getting the same response.
    slocate is included as a secondary group for the user.
    TIA
    Tim

    #2
    Re: Locate is not available to user

    It appears, that in *ubuntu, the command is slocate:
    SLOCATE(1) SLOCATE(1)

    NAME
    slocate - Security Enhanced version of the GNU Locate

    SYNOPSIS
    slocate [-qi] [-d <path>] [--database=<path>] <search string>
    slocate [-i] [-r <regexp>] [--regexp=<regexp>]
    slocate [-qv] [-o <file>] [--output=<file>] slocate [-e
    <dir1,dir2,...>] [-f <fstype1,...>] <[-l <level>] [-c] <[-U <path>]
    [-u]>
    slocate [-Vh] [--version] [--help]

    DESCRIPTION
    Secure Locate provides a secure way to index and quickly search for all
    files on your system regardless of ownership. It uses incremental
    encoding just like GNU locate to compress its database to make search‐
    ing faster, but it will also check file permissions and ownership
    before displaying matched entries so that users will not see files they
    do not have access to. Note that permissions and ownership are not
    stored in the database.

    This manual page documents slocate. slocate Enables system users to
    search entire filesystems without displaying unauthorized files.
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: Locate is not available to user

      [quote=Snowhog ]
      It appears, that in *ubuntu, the command is slocate:
      [quote]
      <..snipped..>
      locate is symlinked to slocate.
      from my machine:
      tim@bart:~$ ls -ltr /usr/bin/locate
      lrwxrwxrwx 1 root root 7 2007-10-28 05:28 /usr/bin/locate -> slocate

      Comment


        #4
        Re: Locate is not available to user

        I'm going to guess that the problem is the symlink, which is owned by your user, but calls a file requiring root access to execute. That would explain why running your 'locate' without sudo fails.

        Why (and I'm just curious) don't you just run slocate as root with sudo slocate??
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Re: Locate is not available to user

          I'm not clear why I would wish to use sudo to run locate or
          slocate. Sounds bloody inconvenient, since I use this command
          so frequently.

          All the same, I reran the install and no longer have the
          problem.

          I think your suggestion regarding the symlink is right
          on target. If I run into this problem again, that's the first
          thing that I will check.

          Thanks.
          Regards,
          Tim

          Comment


            #6
            Re: Locate is not available to user

            Originally posted by tim042849
            I'm not clear why I would wish to use sudo to run locate or
            slocate. Sounds bloody inconvenient, since I use this command
            so frequently.
            *ubuntu uses sudo differently, which is why there isn't a separate root account created during installation.

            See Root Revival, comments by UnicornRider. It may shed some light on the subject for you.

            And, you are welcome.
            Windows no longer obstructs my view.
            Using Kubuntu Linux since March 23, 2007.
            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

            Comment


              #7
              Re: Locate is not available to user

              The link may have changed since you last reviewed it. I see nothing
              by unicornrider.

              It's late here and I'm about to call it a day, but if you feel that using
              sudo with locate/slocate is a better idea, I would find it useful to
              see your opinion. After all, (having only used sudo for a few months),
              it would appear that there is a time-out feature? IOWS, multiple calls
              to 'sudo locate' within a short period of time might not necessitate
              repetitive password entries. Am I correct?

              Thanks Again
              Tim

              Comment


                #8
                Re: Locate is not available to user

                There should be no need to 'sudo' locate (really slocate, as mentioned).

                Also there should be no need to add the user to the 'slocate' group, as /usr/bin/slocate should have the SGID permission bit set (-rwxr-sr-x = 2755), which means the executable will run with the effective GID of group 'slocate'.

                Permissions of slocate database should be set as:
                /var/lib/slocate drwxr-x--- (750) root slocate
                /var/lib/slocate/slocate.db = -rw-r----- (640) root slocate

                Comment


                  #9
                  Re: Locate is not available to user

                  Originally posted by tim042849
                  The link may have changed since you last reviewed it. I see nothing
                  by unicornrider.
                  The link is his web site. UnicornRider is the sudonym he uses on this forum.
                  Windows no longer obstructs my view.
                  Using Kubuntu Linux since March 23, 2007.
                  "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                  Comment

                  Working...
                  X