Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way I can make things just assume that when I run them I am running them as a privileged administrator (AKA root)? I know it could be dangerous and all, but its a risk I'm willing to take in the name of convenience.

share|improve this question
    
Do not do this. It will break your system (apart from exposing your machine to attacks). Read unix.stackexchange.com/questions/1052/… –  MarkovCh1 Jan 21 '12 at 6:39
    
But if you still want to run specific applications as root, see wiki.archlinux.org/index.php/Sudo –  MarkovCh1 Jan 21 '12 at 6:40
1  
Jon, I rolled back your edit. Even if you're not going to do it, the question/answer still remains useful to anyone else considering this. To keep this page useful the question should remain, or new visitors will just see "question withdrawn" followed by an answer to a question they can't see :) –  Caesium Jan 21 '12 at 8:22
2  
Should not be down voted either for the same reason –  Mark Rooney Jan 21 '12 at 8:37
2  
Yep, it's an excellent question. The only thing stupid here is not taking the advice in the comments & answers. +1 –  Tom Brossman Jan 21 '12 at 22:37

3 Answers 3

up vote 21 down vote accepted

Normally I'd include instructions in an answer, but this is such a bad idea I'll point you to a couple places to read up on how to do this. You can take it from there. Note that when you break your system you can post here again for help, but people will laugh and shake their heads and make reference to pebkac errors, etc.

First, the Ubuntu help page on Root/sudo. Note the three large, prominent warnings.

Here's an Ubuntu Forums user that did something like this and couldn't fix their system.

Keep backups of your data if you do it, and consider the wisdom of trading security for convenience. Maybe put on an old Dead Kennedys album while you reinstall...

share|improve this answer

Please don't do that. You're not only hurting yourself, but you're also hurting others. There are enough zombies, spambots and DDoS hosts as it is.

share|improve this answer

If you are only interested in specific things running as root, the setuid bit is the appropriate feature.

By setting this bit, the program will run with the permissions of it's owner. Therefore you can take a program, change it's owner to root, set it's setuid bit, and that program will then run as root with no special intervention.

Some programs in Ubuntu are setuid by default - for example, ping

> ls -l `which ping`
-rwsr-xr-x 1 root root 35712 2011-05-03 11:43 /bin/ping

This program needs to run as root because only root can open a port below 1024 for listening, which is required to listen for return packets.

As noted, allowing programs root permissions by default is dangerous, and is typically reserved for simple, well-audited programs - any program which could be exploited as the result of external input will run the risk of exposing your entire system to compromise, instead of just those areas your user account has access to.

share|improve this answer
    
Unrelated: :sigh: Unix security: must give away entire system to open a listening port. How does that work though? Nobody runs e.g. apache as root... –  Billy ONeal Jan 21 '12 at 17:08
1  
I believe Apache handles it by spawning child processes with less privileged UIDs and only starting one master process that opens port 80 as root. The child processes handle all user requests. I think another common pattern is that processes will start setuid root, and then use setuid to change to a limited user as soon as they have acquired the resources they needed root to use ; unixwiz.net/techtips/chroot-practices.html –  Adrian Jan 23 '12 at 11:49

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.