Run application as root without sudo
I have an application (VirtualBox) which I need to run as root user. I can run sudo VirtualBox just fine, but I want to have a shortcut on my Desktop which I only have to click on to start VirtualBox as root user. I tried chown root:root, but that doesn't do anything.
Thanks!
Btw: I'm running Debian Squeeze.
You can still use sudo to run programs without having to type a password. You can do this by running the visudo
command and adding a line in for VirtualBox:
sudo visudo
Add the following line to the file
yourusername ALL = NOPASSWD: /path/to/virtualbox
Then create a desktop shortcut to sudo /path/to/virtualbox
and it should run as root without a password.
if you make sure that executable is only accessible by the user you want it to run, then you could set the SetUser bit in permissions like:
chown root:root myexecfile
chmod u+s myexecfile
when you do that, the file will run with set-uid bit, ie its owners permissions, instead of the user who runs it. You could use chmod g+s myexecfile to same end, only set group but instead of user bit.
However, be very careful: if you leave this file in the open, it is an inherently insecure way. For instance, if you put it on your desktop, make sure your Desktop folders permissions are 700 (no access to anyone but you).