Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
possible duplicate of Configuring sudo to work without password –  mailq Oct 22 '11 at 10:38
1  
I should tell you that you haven't set up VirtualBox correctly - it does not normally require root to run. –  Kvisle Oct 22 '11 at 13:07
    
Kvisle is right, VirtualBox doesn't normally require root-access. But (at least on debian) virtualbox-users should normally belong to the vboxusers-group. –  olemd Nov 9 '11 at 18:33
add comment

3 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
Thanks a lot! That worked like a charm! –  LinuxNewbie Oct 22 '11 at 12:01
add comment

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).

share|improve this answer
add comment

You should use gksudo for this purpose. It will allow you to run graphical programs as root, using a graphical authentication prompt. Making the binary setuid-root or removing password requirement for sudo will open you up to privilege escalation attacks.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.