0

I have a directory (called server) where the permissions somehow got messed up, so I need to change all the permissions back. My current command is

sudo chmod -R -c a+w *

But chmod just says chmod: cannot access '*': No such file or directory

What am I doing wrong here? Am I missing something obvious?

  • Possibly there is nothing (no file and directory) in the current directory. Try to specify full path... – FedonKadifeli Dec 2 at 19:43
1

This error only happens if you dont have any file on the current folder. Execute the ls command to check it.

0

Perhaps you screwed up the permissions of "." (current directory) or ".." (parent directory).

/bin/ls -ld . ..

should show something like

walt@bat:~(0)$ /bin/ls -ld . ..
drwx------ 255 walt walt 282624 Dec  2 13:50 .
drwxr-xr-x   7 root root  36864 Sep 10 12:08 ..
walt@bat:~(0)$ cd tmp
walt@bat:~/tmp(0)$ /bin/ls -ld . ..
drwx------  51 walt walt  12288 Oct 31 01:27 .
drwx------ 255 walt walt 282624 Dec  2 13:50 ..
walt@bat:~/tmp(0)$ 

Read man -a chmod.

0

The * file wildcard does not automatically expand files beginning with a dot (.) Any such files will not be included, and if all files/directories begin with a dot, none will be, producing your error message.

0

First confirm you have the right directory name by listing files in it:

ls /server/*

Then if the names appear use the command:

sudo chmod -R -c a+w /server/*

In your question you didn't use server in the command, nor did you change to the directory before entering the command.

  • You've got to leave off the /* for that to work if the file/subdirectories start with a dot. Also, the server directory is not likely to be under root, so the initial slash is possibly wrong. cd to the dir containing server, then just use server as the file arg. – ubfan1 Dec 3 at 2:07
  • @ubfan1 When I tested I used ~/python/* and it worked but there are no subdirectories under it. So I just tried it on /tmp/* and it worked on subdirectory within it. Also the . files and subdirs are all have w set now. We really need to the OP to respond with real directory name with full path before proceeding further. – WinEunuuchs2Unix Dec 3 at 2:38
0

I fixed it! It turned out that somehow I had the server folder owned by root, and that mean chmod couldn't see it. I used chownto change the permissions over to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.