mirror of https://github.com/dadevel/wg-netns
use getpass to get user
`os.getlogin()` does not seem to work in all cases, however `getpass.getuser()` does. Example: ``` $ sudo python Python 3.11.3 (main, May 16 2023, 12:21:43) [GCC 12.2.1 20230428] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getlogin() Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [Errno 2] No such file or directory >>> import getpass >>> getpass.getuser() 'root' ```pull/17/head
parent
2bbc743d9b
commit
4b334c60e3
Loading…
Reference in New Issue