使用错误的chmod语法在文件上丢失权限Centos 5.5

我试图删除整个目录的写权限,我使用了不正确的命令:

chmod 644 -r sites/default

我打算打字

chmod -R 644 sites/default

结果是这样的:

 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 dw------- 3 user group 4096 Jan 11 10:43 default 4 -rw-r--r-- 1 user group 1849 Apr 15 2010 example.sites.php 

我用$ chmod 644 sites / default修改了默认文件夹的权限但是,下面的ls显示了所有带有红色背景和问号的文件。 我不能访问任何文件,除非我是根。

 $ ls -als sites/default total 0 ? ?--------- ? ? ? ? ? . ? ?--------- ? ? ? ? ? .. ? ?--------- ? ? ? ? ? default.settings.php ? ?--------- ? ? ? ? ? files ? ?--------- ? ? ? ? ? settings.php 

当我以rootlogin时,我可以编辑所有的文件,并且他们的权限显示正确。 我不知道如何解决由于使用-r而不是-R而导致的损坏。

有什么build议么?

首先,这样做:

 chmod 755 sites/default 

您看到的输出是因为您没有目录上的执行权限:

 $ 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 

为什么不用适当的权限再次运行相同的命令,然后将所需的权限应用到网站/默认?