I'm writing a shell script in Python for bash. The script automatically runs when the user logs into the account, and I want it to log the user out when it exits. I tried using os.system('exit'), but it doesn't work. How would I achieve this?
Set your python script as the login shell of the user(in /etc/passwd/). This way she will be automatically logged out after the script exits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With