Why can't I access this folder?
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) ex
exute permissions.
Comments
-
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 about 12 yearsYou're missing execute permission.
-
StepTNT about 12 yearsExecute permissions on a directory? Sounds strange!
-
Chris Stratton about 12 yearsMat is right, you need the execute permission (x) on directories
-
Jörg W Mittag about 12 yearsThere 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 about 12 yearsMat, Chris Stratton, that fixed it. Thanks!
-
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 about 12 yearsYeah, thanks! I was just asking :)
-
-
Rick Hodgin about 12 yearsJorg, thanks! And fwiw to my mind I AM trying to "read" that directory/folder, not execute it. Wacky! :-)