Run Python script like superuser

#1

Hey! Im new. I have ubuntu in my computer, and here is the problem.

The thing is that i need to run a script from Atom(i have de script package) as a superuser. There is a way to do this?

This is because the script im coding use access to serial ports on my machine, and the only way i found to make it rune is with sudo in the console, but not with Atom. I already give to my user a lot of privileges, but still not working.

Sorry for my English.

Thaks

0 Likes

#2

You can’t do that with script. The easiest way to do it would be in a terminal package such as terminal-plus or termination, and then you can just use sudo normally.

0 Likes

#3

Run the script with the setuid bit set and change the owner to root.

chown root:users script
chmod 4755 script

Jason

0 Likes