Why can't I access this folder?

11,966

You're neither trying to read (list) nor write (create a new entry) the directory. You want to enter it, therefore you need (slightly misnamed in the case of directories) exexute permissions.

Share:
11,966
Rick Hodgin
Author by

Rick Hodgin

Software developer, journalist, welder.

Updated on June 20, 2022

Comments

  • Rick Hodgin
    Rick Hodgin almost 2 years

    A while back I bought a 1TB USB external drive. I formatted it ext4 in Ubuntu and copied a bunch of files / folders to it from several machines, all to /home/machinename/whatever, respectively.

    At some point I ran a chmod -R shell command on it to change the permissions. That was months ago and I don't remember what I typed but it made the drive so I could only access its /home folder as root. This wasn't a problem because I could still access everything, but today I decided to try to fix it.

    I went to my shell as root, went to that drive and typed:

    chown -R rick:rick ./
    chmod -R 666 ./
    

    It seemed to work. That home directory and everything else in it now shows up as rw for each:

    rick@rick64:/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee$ ls -l
    drw-rw-rw- 7 rick rick 4096 2012-03-04 13:08 home
    

    So, if I try to access that directory with the shell, I get:

    rick@rick64:/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee$ ls -l
    drw-rw-rw- 7 rick rick 4096 2012-03-04 13:08 home
    rick@rick64:/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee$ cd home
    bash: cd: home: Permission denied
    rick@rick64:/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee$ _
    

    When I access it with nautilus I can see the multiple machine names within the /home/ folder, but they all appear with a file icon. I can right-click on them and choose "Properties" but it won't let me see the permissions.

    Am baffled. Why can't I access that folder? I'm the owner? I'm even the group. I have r/w privileges. What am I doing wrong?

    • Mat
      Mat about 12 years
      You're missing execute permission.
    • StepTNT
      StepTNT about 12 years
      Execute permissions on a directory? Sounds strange!
    • Chris Stratton
      Chris Stratton about 12 years
      Mat is right, you need the execute permission (x) on directories
    • Jörg W Mittag
      Jörg W Mittag about 12 years
      There are three bits for permissions. They mean different things for different kinds of files. For regular files, they mean read-write-execute. For directory special files, they mean read-write-enter.
    • Rick Hodgin
      Rick Hodgin about 12 years
      Mat, Chris Stratton, that fixed it. Thanks!
    • Chris Stratton
      Chris Stratton about 12 years
      @StepTNT From chmod man page: "The letters rwxXst select file mode bits for the affected users: read (r), write (w), execute (or search for directories) (x)" More generally, although I'm glad this was quickly resolved for Rick, it really belonged on one of the usage sites rather than here.
    • StepTNT
      StepTNT about 12 years
      Yeah, thanks! I was just asking :)
  • Rick Hodgin
    Rick Hodgin about 12 years
    Jorg, thanks! And fwiw to my mind I AM trying to "read" that directory/folder, not execute it. Wacky! :-)