[PyQt] Asking for temporary privilege elevation
    Barry 
    barry at barrys-emacs.org
       
    Sat Jan  6 13:11:57 GMT 2018
    
    
  
> On 6 Jan 2018, at 12:11, Shriramana Sharma <samjnaa at gmail.com> wrote:
> 
> Hello. I'm writing a PyQt5 program that can do its basic function
> without superuser permission, but for one function (modifying a system
> configuration file under /usr/) it needs superuser permission.
> 
> I checked on StackOverflow but though there is talk about using
> SUDO_ASKPASS and subprocess.run or such, I didn't find any clear
> specific methods of asking for privilege elevation of the *current*
> process so I can directly open and modifying such files using Python
> file IO.
This is not pyqt problem. But short answer is you cannot change current process privs.
Use subprocess to spawn a sudo command line. You need to set sudo askpass to allow the sudo password to be entered.
Barry
> 
> Please advise. Thank you!
> 
> -- 
> Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा 𑀰𑁆𑀭𑀻𑀭𑀫𑀡𑀰𑀭𑁆𑀫𑀸
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
    
    
More information about the PyQt
mailing list