So I am writing a script in python that inputs commands directly to the terminal of an Ubuntu machine. I use the os.system function to input the command to get super user access and I am having a bit of trouble entering the password into the script and getting super user privileges. Here's my code:
import os
def runUpdates():
suPassword = input("Enter su password: ")
su = os.system("sudo su")
su2 = os.system(suPassword)
return su
return su2
If anyone can help that would be appreciated. Sorry if this is too vague of a question.