I want to give a running process sudo permissions. Like if I have opened eclipse normally. Now when I start my server on eclipse it needs sudo permission but for that I will have to close the eclipse and then open it with sudo eclipse to get sudo permission. I tried setting the setuid and setgid of /usr/bin/eclipse but that didn't worked. I don't know why it didn't worked.
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
Setuid/setgid didn't work as those file mask bits are used by the kernel, when the process is created, to give it the elevated privileges.
I don't believe it's possible without adding major pieces of functionality to the kernel.
I think you mean "root permissions". Setting SUID root on the giant mass of code called "Eclipse" is not a good idea.
What you need is an SUID wrapper, which has to be a binary. Hm, that's what sudo is. But sudo asks for your password. You need to run it with the -A switch , and have the SUDO_ASKPASS environment variable set to something like /usr/bin/x11-ssh-askpass. Then you will get GUI popup asking for your password, and then the spawned program will run with elevated privileges.
That is different than changing the permissions on an anlready running process, which your question title implies. That you cannot do, AFAIK.