7

I know it is possible to enable root user and then logging in as the root user. But is it possible to get root access with your admin account in OSX Mavericks?

It is kinda annoying to always type the password whenever you are installing stuff and using the terminal.

Last resort would be to always login as the root user?

dwightk
  • 7,619
  • 14
  • 47
  • 70
WYS
  • 171

2 Answers2

9

sudo asks for the admin password only if you haven't used the command in the last 15 minutes or so. For extended root sessions I usually run sudo -s to create a new shell with root privileges.

nohillside
  • 100,768
  • That's a good solution, noted. – WYS Mar 16 '14 at 16:11
  • 1
    Alternately, you could do sudo -v periodically. That'll reset the timer to 15 minutes (only prompting for your password if it's already expired). You might also edit the sudoers file and raise the time limit (don't raise it too high, though). – Blacklight Shining Mar 16 '14 at 21:48
1

Theoretically speaking, you could add your admin account into the wheel group, then use visudo to edit the sudoers file to allow your user account to execute commands as root. Not only would you have root privileges automatically in Terminal, it would also apply to the GUI as well (no more entering passwords when installing packages or unlocking preferences). However, granting root access to any account other than the root user is a Bad Idea and would be the Wrong Thing to do. The security ramifications of doing this are extreme, and could seriously mess up your system if you don't know what you're doing (and even if you do).

But you did want to know if it was possible.

Matt
  • 891
  • 5
  • 14
  • 1
    That's not how wheel works. Being in group wheel would give you access to gid 0, not uid 0. wheel is generally used on BSD (though not OS X by default) to restrict who can su/sudo to root, but does not automatically confer rights. cf. http://administratosphere.wordpress.com/2007/07/19/the-wheel-group/ – Mattie Mar 17 '14 at 00:28
  • 2
    You could always set your account's uid to 0; there's nothing preventing multiple accounts sharing a uid on Unix. That said, this is an absolutely, really, completely, totally, and utterly terrible idea. – sapi Mar 17 '14 at 03:29
  • @zigg Thanks for the correction--I was thinking of this line being changed to allow the specified user to execute commands as root. – Matt Mar 18 '14 at 21:55
  • On OS X, the admin group actually does have sudo rights without all the wheel etc. You'll have this group membership if your account has the "Allow user to administer this computer" box ticked. cf. /etc/sudoers, which you can't even look at unless you're root or in the wheel group. – Mattie Mar 18 '14 at 22:10