I was trying to remove write
permissions on an entire directory, and I used the incorrect command:
chmod 644 -r
sites/default
I meant to type
chmod -R 644
sites/default
The result was
this:
chmod: cannot access `644':
No such file or directory
$ ls -als sites
total
24
4 drwxr-xr-x 5 user group 4096 Jan 11 10:54 .
4 drwxrwxr-x 14
user group 4096 Jan 11 10:11 ..
4 drwxr-xr-x 4 user group 4096 Jan 5 01:25
all
4 d-w------- 3 user group 4096 Jan 11 10:43 default
4 -rw-r--r--
1 user group 1849 Apr 15 2010
example.sites.php
I
fixed the permissions on the default folder with
$ chmod 644
sites/default
But, the following ls shows a all the files with red backgrounds
and question marks. I can't access any files unless I am
root.
$ ls -als
sites/default
total 0
? ?--------- ? ? ? ? ? .
?
?--------- ? ? ? ? ? ..
? ?--------- ? ? ? ? ?
default.settings.php
? ?--------- ? ? ? ? ? files
? ?--------- ? ? ?
? ?
settings.php
When
I log in as root, I can edit all of the files, and their permissions appear correctly. I
do not know how to undo the damage caused by using -r with chmod instead of
-R.
Any Suggestions?
Answer
First, do this:
chmod 755
sites/default
The
output you are seeing is because you don't
have execute permission on the
directory:
$ mkdir -p
foo/bar
$ touch foo/bar/a foo/bar/b foo/bar/c
$ ls -l
foo
total 4
drwxr-xr-x 2 thedward thedward 4096 2011-01-11 10:28
bar
$ ls -l foo/bar
total 0
-rw-r--r-- 1
thedward thedward 0 2011-01-11 10:28 a
-rw-r--r-- 1 thedward thedward 0
2011-01-11 10:28 b
-rw-r--r-- 1 thedward thedward 0 2011-01-11 10:28
c
$ chmod 644 foo/bar
$ ls -l foo/bar
total
0
-????????? ? ? ? ? ? a
-????????? ? ? ? ? ? b
-?????????
? ? ? ? ? c
$ chmod 755 foo/bar
$ ls -l
foo/bar
total 0
-rw-r--r-- 1 thedward thedward 0 2011-01-11 10:28
a
-rw-r--r-- 1 thedward thedward 0 2011-01-11 10:28 b
-rw-r--r-- 1
thedward thedward 0 2011-01-11 10:28 c
Comments
Post a Comment