Lost Permission on Files using wrong chmod syntax Centos 5.5
Posted
by
alloutfallout
on Server Fault
See other posts from Server Fault
or by alloutfallout
Published on 2011-01-11T16:18:52Z
Indexed on
2011/01/11
16:55 UTC
Read the original article
Hit count: 321
permissions
|chmod
Hello,
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?
© Server Fault or respective owner