[Python-ideas] Add shutil.chown(..., recursive=False)
Steven D'Aprano
steve at pearwood.info
Mon May 28 19:47:42 EDT 2018
On Mon, May 28, 2018 at 10:13:47PM +0100, Barry wrote:
>
> > On 28 May 2018, at 21:23, Giampaolo Rodola' <g.rodola at gmail.com> wrote:
[...]
> > It appears like a common enough use case to me ("chown -R path").
> > Thoughts?
>
> I wonder if it is very common.
> Don’t you have to be root or use sudo chown?
> In which case it is only python code running as root that could use this.
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?
[steve at ando ~]$ ls -lR test
test:
total 12
-rw-rw-r-- 1 steve steve 5 Feb 4 2017 eggs.py
drwxrwxr-x 2 steve steve 4096 May 29 09:41 package
-rw-rw-r-- 1 steve steve 40 Feb 4 2017 spam.py
test/package:
total 0
-rw-rw-r-- 1 steve steve 0 May 29 09:41 __init__.py
-rw-rw-r-- 1 steve steve 0 May 29 09:41 spam.py
[steve at ando ~]$ chmod -R a-w test
[steve at ando ~]$ ls -lR test
test:
total 12
-r--r--r-- 1 steve steve 5 Feb 4 2017 eggs.py
dr-xr-xr-x 2 steve steve 4096 May 29 09:41 package
-r--r--r-- 1 steve steve 40 Feb 4 2017 spam.py
test/package:
total 0
-r--r--r-- 1 steve steve 0 May 29 09:41 __init__.py
-r--r--r-- 1 steve steve 0 May 29 09:41 spam.py
--
Steve
More information about the Python-ideas
mailing list