0

I'm the owner of a folder, yet I cannot cd into the folder.

After some searching I discovered that you need execute permission to cd into the folder.

I then did:

sudo chmod u+w myfolder

To add execute permission for my user. Yet I still cannot open the folder.

Zanna
  • 70,465
panthro
  • 286
  • 1
  • 4
  • 12
  • What folder is it? Where is it located? It would be a huge help if you included the results of ls -lh folderName in the directory of your folder (replacing yourFolder with the actual folder name) – grooveplex Oct 27 '16 at 08:52
  • /var/www/my-site result of sudo ls -lh: drw-r--r-- 13 myuser www-data 4.0K Oct 21 15:51 site – panthro Oct 27 '16 at 08:55
  • and where does that show -execute- permissions? drw- = directory, read, write, no execute. sudo chmod 755 myfolder is the command to use. – Rinzwind Oct 27 '16 at 09:17

1 Answers1

3

The command you entered

sudo chmod u+w myfolder

grants write permission to the owner... There it is:

drw-r--r-- 13 myuser www-data
  ^--owner may write

You wanted execute permission

chmod u+x myfolder

(you won't need sudo if you own it). That will give you

drwxr--r-- 13 myuser www-data
   ^--owner may enter and search

(octal 744) - but there's not much point in that setting - probably you either want 755 (all can access) or 750 (owner and group can access) or 700 (only owner can access), since read permission for directories isn't much use without execute permission.

Zanna
  • 70,465