I want to validate root password which is entered by user script which is used to install the driver which requires root.
if I try to run that installer as a sudo
or superuser privilege
it gives below Error:
ERROR: installer must be run as root
I am accepting the password with the help of getpass()
method at the beginning of a script and will use that password in between the execution of it so don't want to make a user wait for such long time.
I found what-is-the-best-way-for-checking-if-the-user-of-a-script-has-root-like-privileg and how-to-verify-a-users-password-for-root-privledges-in-python but this will check validation of sudo password not the root
.
I want to check password is valid for root login.
How Should I validate that user entered the password
is correct for root
using python?
As well as My knowledge is a concern I have to check the validity of root password by performing so su
operation
we can not run the whole script as a root as after installation script is going to run some test as a normal user.