Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kann

macrumors newbie
Original poster
Apr 7, 2009
11
0
I'm currently on Macbook Air with OS X 10.8.2 today. Regarding to this article from Apple, my root account is currently disabled.

So, from a friend's suggestion, I just tried...

Code:
sudo su

on my terminal. I know it's weird. The command seems unnecessarily redundant, but it grants me access to root right away. :eek::eek::eek:

Is this normal? Could you guys please try running this command on your shell for me?

----------

Also, it didn't even ask for my admin password. :eek::confused::confused:
 

ChristianVirtual

macrumors 601
May 10, 2010
4,122
282
日本
Did you at least got asked for a password ?

Ok, just see you remark. Do you have password set to login to you machine/ auto login ? Did you entered the admin password short before with another command ?
 

costabunny

macrumors 68020
May 15, 2008
2,466
71
Weymouth, UK
The root account isnt exactly disabled by default - its not allowed to login. Means you can escalate to root in the shell, but not login to the mac either locally or remotely as the root user directly.

When running 'sudo su' you are saying please let me switch user to superuser (root).

It should however ask for your user password. That is the one you use to login to your mac with.
 

Kann

macrumors newbie
Original poster
Apr 7, 2009
11
0
Did you at least got asked for a password ?

Ok, just see you remark. Do you have password set to login to you machine/ auto login ? Did you entered the admin password short before with another command ?

I just sudo with other commands while a go. May be this is the reason why it didn't ask for my password.

----------

The root account isnt exactly disabled by default - its not allowed to login. Means you can escalate to root in the shell, but not login to the mac either locally or remotely as the root user directly.

When running 'sudo su' you are saying please let me switch user to superuser (root).

It should however ask for your user password. That is the one you use to login to your mac with.

Aha, this explains it. Thanks for this info! :D:D:D
 

Macman45

macrumors G5
Jul 29, 2011
13,197
135
Somewhere Back In The Long Ago
I just sudo with other commands while a go. May be this is the reason why it didn't ask for my password.

----------



Aha, this explains it. Thanks for this info! :D:D:D


Once you've used your password after the sudo command, that session will remain active and you can type commands without the password prompt. Useful for playing around with power settings etc...which I've been doing all morning....FInally cured the wake from sleep issue on my newbie..:)
 
Last edited:

Armyguy6902

macrumors newbie
Mar 11, 2013
1
0
sudo su help

ok so long story short. i just received my new 21.5 imac and had saved some info last week on my iPad regarding how to erase all stuff on my macbook air so i could then sell it. i was only able to get the first line to work in terminal. that line was
sudo su

then it asks for my password (i type it) and now on to the next line of text.

dscl . -delete /groups/admin groupmembership first last (those are my names for my account)

it gave me some error message. now im just going to restart and reinstall the OS from disk utility. as soon as my MBA starts up i am holding the command & S button and all of a sudden i am getting lines of txt like im using the MS-DOS prompt. needless to say i cant figure out how to reverse whatever it is that i did. any help would be greatly appreciated.

additional info: at the bottom of the startup txt it says

if you wish to boot the system:
exit
:/ root#
 

jasonvp

macrumors 6502a
Jun 29, 2007
604
0
Northern VA
Code:
sudo su

FWIW, I never understood that one. A lot of the systems administrators I know do the same thing. Assuming you have all privs in the sudoers file, you can run any command with it. Like, say, a shell.

Code:
sudo /bin/sh

...for instance. It'll still ask for your password, but it avoids the su step and just executes the shell. Voila: you're root.

jas
 

cjmillsnun

macrumors 68020
Aug 28, 2009
2,399
48
FWIW, I never understood that one. A lot of the systems administrators I know do the same thing. Assuming you have all privs in the sudoers file, you can run any command with it. Like, say, a shell.

Code:
sudo /bin/sh

...for instance. It'll still ask for your password, but it avoids the su step and just executes the shell. Voila: you're root.

jas


Code:
sudo -s

will give you a shell with root privileges
 

switon

macrumors 6502a
Sep 10, 2012
636
1
RE: env...

Hi,

While the "env" utility is deprecated, it is still found in the current Mac OS X at /usr/bin/env. If you set this executable's owner to root, the group to wheel, and its mode to setuid, then you can promote a command to root privileges using the env command. For example, if you execute the following:
Code:
env id
it will return the euid set to root and the egid set to wheel. Note that the uid and gid are not changed, just the euid and egid. (Be careful when doing this, as you may not want everyone to have access to root privileges. So if you want to use this privilege promotion scheme, then you might consider copying the env utility to a directory that only you have access to, and changing the ownership and mode for this copy. This way not everyone on your system will have access to the env utility that will promote privileges. By the way, this is always a problem for any executable that has setuid and setgid privileges, but it is particularly dangerous for the "env" command since this command will run other commands with promoted privileges.)

If you have root privileges, then you can change the ownership and mode of "env" using the following commands.
The owner and group are set to root and wheel via:
Code:
chown root:wheel env
The mode is set to setuid via:
Code:
chmod ugo+s env

Regards,
Switon
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.