running programs as user but with root privileges
by terence from LinuxQuestions.org on (#5AP8C)
This is a question more out of curiosity than a need to solve a specific problem.
I'm wondering if there is a way to run an executable as an ordinary user but wuth root privileges. As far as I can understand, neither sudo, setuid, pkexec or something similar would work, as they all allow users to run things as root. For example, if I sudo something and in the process create a file, that file would belong to root rather than myself. What I'd like to do is run something as myself but with root privileges, so if I create a file, the file belongs to me but having root privileges would allow me to, say, save the file to a directory where I don't normally have write permission.
Maybe there is no way to do this but if there is, I'd like to know how.
Thanks in advance for any advice.
Terence


I'm wondering if there is a way to run an executable as an ordinary user but wuth root privileges. As far as I can understand, neither sudo, setuid, pkexec or something similar would work, as they all allow users to run things as root. For example, if I sudo something and in the process create a file, that file would belong to root rather than myself. What I'd like to do is run something as myself but with root privileges, so if I create a file, the file belongs to me but having root privileges would allow me to, say, save the file to a directory where I don't normally have write permission.
Maybe there is no way to do this but if there is, I'd like to know how.
Thanks in advance for any advice.
Terence