[Python-ideas] Add shutil.chown(..., recursive=False)

Steven D'Aprano steve at pearwood.info
Mon May 28 20:49:25 EDT 2018


On Tue, May 29, 2018 at 10:11:22AM +1000, Chris Angelico wrote:
> On Tue, May 29, 2018 at 9:47 AM, Steven D'Aprano <steve at pearwood.info> wrote:

> > Certainly not. You only have to be root to change permissions on files
> > that you otherwise wouldn't be able to change permissions on. chmod -R
> > works fine for regular users changing their own files. Why wouldn't it?
> 
> That's chmod. The OP asked about chown.

/face-palm

Indeed he did. But it doesn't matter: regular users can call chown -R:

[steve at ando ~]$ chown -R steve.users test
[steve at ando ~]$ ls -lR test
test:
total 12
-rw-rw-rw- 1 steve users    5 Feb  4  2017 eggs.py
drwxrwxrwx 2 steve users 4096 May 29 09:41 package
-rw-rw-rw- 1 steve users   40 Feb  4  2017 spam.py

test/package:
total 0
-rw-rw-rw- 1 steve users 0 May 29 09:41 __init__.py
-rw-rw-rw- 1 steve users 0 May 29 09:41 spam.py


The limitations on calling chown apply equally to the recursive and 
non-recursive case.


-- 
Steve


More information about the Python-ideas mailing list