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

Wes Turner wes.turner at gmail.com
Wed May 30 02:01:57 EDT 2018


Configuration management tools with far more code than this are regularly
run with root privileges.

OTOH, Salt and Ansible, for example, both support recursive chown and
chmod; and report what actually changed. Yum/dnf probably do, too.

Supporting recursive chmod/chown OOB may be useful. That it might be run as
root is not the criteria, AFAIU.

On Tuesday, May 29, 2018, Chris Angelico <rosuav at gmail.com> wrote:

> On Wed, May 30, 2018 at 9:11 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>
> wrote:
> > BTW, I wouldn't argue that Python shouldn't provide things
> > that are only useful to root. While writing setuid utilities
> > in Python is a bad idea for lots of reasons, I don't think
> > there's anything wrong with becoming root by another means
> > and then running a Python program that you know well enough
> > to trust.
>
> I'd go further. Once a shell script gets longer than about a page or
> two of code, it often needs to be rewritten in a different language,
> and Python is well situated to be that language. That doesn't change
> when the script is to be run as root. I've written many Python scripts
> to do sysadminning jobs for me - usually one-shot scripts, but also
> some that stick around. Since I wrote the scripts myself, the trust
> issue doesn't come up; I trust the Python interpreter the same way
> that I trust /bin/bash.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180530/9625f3e7/attachment-0001.html>


More information about the Python-ideas mailing list