chmod and chown recursion (sudo)
MR ZenWiz
mrzenwiz at gmail.com
Tue Mar 8 08:25:30 UTC 2011
On Mon, Mar 7, 2011 at 7:17 PM, Smoot Carl-Mitchell <smoot at tic.com> wrote:
:
> Check the man page on chmod. The umask does effect the results. Also
> the ugo+rw *adds* the bits indicated and does not affect bits already
> set in the permission.
>
Here is what I see:
$ umask
0002
$ ll EmpHist.odt
-rw-rw-r-- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$ chmod 777 EmpHist.odt
$ ll EmpHist.odt
-rwxrwxrwx 1 mar users 10589 2010-07-07 15:43 EmpHist.odt*
$ alias ll
alias ll='/bin/ls -lF'
$
Note that the umask had no effect. Now:
$ sudo -i
# umask
0022
# ll scsrun.log
-rw-rw-r-- 1 root root 224 2010-04-16 18:33 scsrun.log
root at markbase:~ # chmod 777 scsrun.log
root at markbase:~ # ll scsrun.log
-rwxrwxrwx 1 root root 224 2010-04-16 18:33 scsrun.log*
root at markbase:~ # exit
logout
$ sudo umask
sudo: umask: command not found
$
> Note the "other" 'w' bit is unaffected by the chmod +w * command.
>
That's not what I see - even if I use the ugoa controls:
$ ll EmpHist.odt
-rw-rw-r-- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$ chmod ugo+w EmpHist.odt
$ ll EmpHist.odt
-rw-rw-rw- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$
The umask had no effect on the chmod.
> sudo which inherits the root users umask which is typically 022 will not
> affect the 'w' bit for the group and other.
>
See above.
> If the search 'x' bit was not set on a directory, you will get a
> permission denied message as a normal user. With sudo it overrides the
> permissions, since it is running with root privileges.
>
That's true - OP didn't have a problem listing the directories in
sudo, but when he did not use sudo, the error on the directory popped
up.
It's possible that my system has some bizarro settings that are
causing this to be different from what you are seeing, or the man page
- wouldn't be the first time. However, I have not messed with
anything that I know of which might be responsible for such a change.
(Ideas welcome.)
More information about the ubuntu-users
mailing list