Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If the owner of a Mac hasn't enabled the root account (via NetInfo manager and the usual suspects) then is it possible to successfully execute a sudo'd command to effect root tasks? Why / Why not?

I don't have an unadulterated Mac to test this.

share|improve this question
2  
I don't believe enabling the root account is necessary, since the password I use for sudo is the same one I use to log in. Then again, it may be that long since I set up my Mac and I don't remember enabling root. –  user3463 Jun 2 '11 at 4:25
1  
NetInfo Manager has been obsolete for the last few releases of OS X. –  Daniel Beck Jun 2 '11 at 7:54
add comment

2 Answers

up vote 2 down vote accepted

Yes, Mac OS X allows use of sudo when the root account has not been activated. Administrators will be put in /etc/sudoers when their account is created; you can edit it manually to add or remove users the old-fashioned way as well.

The reason is mainly security. As any *nix veteran will tell you, logging in as root when you don't have to is A Bad Idea. As root has read, write and execute permissions for everything, a few errant keystrokes can make a real mess of the computer. This, of course, makes it a favourite target of hackers and malware authors, too. Presumably Apple deactivates root by default to discourage users from logging in as it (perhaps they were used to running as Administrator on Windows, although this is just as foolish as logging in as root) as well as making it more difficult for someone with ill intent to access the root account (if you enable it by default, you either need to use a default password (which can easily be guessed or figured out) or get the user to choose a password (users generally choose crap passwords)). The root user does, however, still exist on Mac OS X, even when it's disabled - all that does is prevent logging in as root (su root, ssh -l root and so on). As you might expect, many processes are run as root, including these launched with sudo.

share|improve this answer
    
You actually mean No. –  Daniel Beck Jun 2 '11 at 7:53
    
@Daniel Beck No, I mean yes. At least in answer to "If the owner of a Mac hasn't enabled the root account...then is it possible to successfully execute a sudo'd command to effect root tasks?". Perhaps it's just not using no double negatives that's ending up confusing each other. :-D –  Scott Jun 2 '11 at 8:31
1  
OK, didn't see that; I was more focused on the title I guess ;) –  Daniel Beck Jun 2 '11 at 8:37
    
@Daniel Beck I see where you're coming from now. :-) You had me all worried that I'd got myself mixed up. –  Scott Jun 2 '11 at 8:39
add comment

By default, administrative users will be able to use sudo, non-administrative users will not. You can customize this by editing /etc/sudoers if you want to.

share|improve this answer
1  
I'll add that the recommended way to edit the sudoers file is "sudo visudo", which double-checks that you don't break the file when you save your change. –  Spiff Jun 2 '11 at 4:46
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.