Suppose i start a process p1 using QProcess. The process p1 requires root privileges, so can we pass on password to process p1 without human intervention, of course password being read from some location
Suppose i start a process p1 using QProcess. The process p1 requires root privileges,
Share
You might consider using setuid tricks to perhaps have a helper executable, started by your application, which is setuid root and runs the appropriate things.
Beware when doing that, there is a security risk if you don’t code very carefully. You should ensure that this internal helper executable is only started by your application. (It could communicate with it, eg thru pipes or other IPC).
(You could also configure
sudoorsupervery carefully)Notice that
setuidis tricky. I strongly recommend reading several documentations on it,notably Advanced Unix Programming and Advanced Linux Programming. And read them carefully and several times. Read also carefully execve(2) and credentials(7) man pages (and others). Misunderstanding setuid is a huge security risk.
Don’t forget to minimize the program using setuid tricks. In particular, don’t make your whole Qt application setuid, just make a small helper program setuid.