chmod and chown recursion (sudo)
Nils Kassube
kassube at gmx.net
Wed Mar 16 22:05:04 UTC 2011
Thufir Hawat wrote:
> From what I see, the download has odd permissions and ownership which
> I've not yet fixed.
> thufir at tleilax:~/Downloads$ wget
> http://apress.com/resource/bookfile/4045 --2011-03-15 09:53:22--
> thufir at tleilax:~/Downloads$ ll
> total 24
> drwxr-xr-x 2 thufir thufir 4096 2011-03-15 09:53 ./
> drwxr-xr-x 80 thufir thufir 4096 2011-03-15 08:56 ../
> -rw-r--r-- 1 thufir thufir 14451 2011-03-15 09:53 4045
> thufir at tleilax:~/Downloads$
> thufir at tleilax:~/Downloads$ tar -xf 4045
Why "tar -xf 4045"? If I use "file 4045" to determine the file type, it
tells me it is gziped. And if I unzip it, it is a tar file. Therefore it
should be "tar xzf 4045" instead.
> thufir at tleilax:~/Downloads$ ll
> total 28
> drwxr-xr-x 3 thufir thufir 4096 2011-03-15 09:53 ./
> drwxr-xr-x 80 thufir thufir 4096 2011-03-15 08:56 ../
> -rw-r--r-- 1 thufir thufir 14451 2011-03-15 09:53 4045
> d--------- 5 thufir thufir 4096 2008-06-22 06:15
> FaceletsEssentials/ thufir at tleilax:~/Downloads$
> thufir at tleilax:~/Downloads$
> thufir at tleilax:~/Downloads$ ll FaceletsEssentials/
> ls: cannot open directory FaceletsEssentials/: Permission denied
Without rx permissions you can't list the directory contents, therefore
I would expect that result.
> thufir at tleilax:~/Downloads$ sudo chmod -R ugo+rw FaceletsEssentials
Why sudo? It is your directory and therefore sudo isn't needed. Granted,
it will ignore the missing x flags for the directories, but a
chmod -R 700 FaceletsEssentials/
should fix it without sudo. Of course it is useful to remove the x flag
for the ordinary files afterwards with something like
find FaceletsEssentials/ -type f -exec chmod 600 {} \;
And if you really want to grant "group" and "others" read permissions,
the numbers would be 755 for directories and 644 for ordinary files.
Nils
More information about the ubuntu-users
mailing list