[New-bugs-announce] [issue34709] Suggestion: make getuser.getpass() also look at SUDO_USER environment variable
Amos S
report at bugs.python.org
Mon Sep 17 00:57:38 EDT 2018
New submission from Amos S <amos.shapira at gmail.com>:
When doing "sudo python-script.py", the output of "getpass.getuser()" is pretty much useless for what it's used (I assume mainly logging and tracking purposes, that's what we use it for ourselves).
I worked around this limitation by using it in expression likes:
username = os.environ.get("SUDO_USER") or getpass.getuser()
I think it'll be useful to many other users if getpass.getuser() could integrate this behavior.
I'd love to provide the code change if this is approved.
----------
messages: 325511
nosy: Amos S
priority: normal
severity: normal
status: open
title: Suggestion: make getuser.getpass() also look at SUDO_USER environment variable
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34709>
_______________________________________
More information about the New-bugs-announce
mailing list