Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

getpass.getuser

'dclong'

getpass.getpass

Prompt the user for a password without echoing. This is a secure way of asking user for password in a Python script.

os.getuid

1000

os.getgid

1000

os.geteuid

1000

os.getegid

1000

os.getresuid

(1000, 1000, 1000)

os.getresgid

(1000, 1000, 1000)

pwd

You can use the pwd module to get the user ID and group ID of any user.

pwd.struct_passwd(pw_name='dclong', pw_passwd='x', pw_uid=501, pw_gid=20, pw_gecos='dclong', pw_dir='/home/dclong', pw_shell='/bin/bash')
20
pwd.struct_passwd(pw_name='dclong', pw_passwd='x', pw_uid=501, pw_gid=20, pw_gecos='dclong', pw_dir='/home/dclong', pw_shell='/bin/bash')
20

Test User’s Access to Path

True
False
total 12K
drwxr-xr-x  1 root   root   4.0K Jun 28 18:12 .
drwxr-xr-x  1 root   root   4.0K Jun 28 18:12 ..
drwxr-x--- 12 dclong docker 4.0K Jul  5 17:25 dclong
True