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

wisecracker

macrumors newbie
Original poster
Sep 24, 2012
18
0
In front of my computer.
I have no idea if this is common knowledge but here goes.

Getting root access on a Terminal inside a MacBook Pro OSX 10.7.5 or lower.
(I have NOT this tested on OSX 10.8.x, MAYBE someone could test...)

you WILL need your ADMIN USER password, a root password in not required.

It will look as though nothing is happening when typing your user password
but carry on ending with a <CR>. <CR> = RETURN/ENTER key.

Inside the Terminal code I have added <CR> to denote the RETURN/NETER key...
Code:
Last login: Thu Nov  1 19:52:20 on console
Barrys-MacBook-Pro:~ barrywalker$ whoami<CR>
barrywalker
Barrys-MacBook-Pro:~ barrywalker$ sudo -s<CR>
Password:_hidden_user_password_<CR>
bash-3.2# whoami<CR>
root
bash-3.2# cd /<CR>
bash-3.2# ls<CR>
.DocumentRevisions-V100	Network			home
.Spotlight-V100		System			mach_kernel
.Trashes		User Information	net
.file			Users			private
.fseventsd		Volumes			sbin
.hotfiles.btree		bin			tmp
.vol			cores			usr
Applications		dev			var
Library			etc
bash-3.2# whoami<CR>
root
bash-3.2# exit<CR>
exit
Barrys-MacBook-Pro:~ barrywalker$ whoami<CR>
barrywalker
Barrys-MacBook-Pro:~ barrywalker$ exit<CR>
logout

[Process completed]

Bazza, G0LCU...
 
That's how sudo works. When you execute a command using sudo, it runs as superuser. In your case you used superuser to invoke a new shell (superuser is of course root).

Nothing to worry about. Only admin users can execute sudo by default in OS X.

Read up on sudo and the visudo command if you are worried.
 
Face palm.

hehe

having the admin password IS root access.

double_facepalm_tng.jpg
 
Hi whiteonline...

I certainly am not worried.

I am well aware of what sudo does too, (Linux flavours).

That is why I quoted, "I have no idea if this is common knowledge but
here goes."

I see many users asking how to get root access on Macs and just gave the information away in its simplest form for ANYONE to understand based on
the MacBook Pro, circa August 2012.

It makes for easy searching in the forums especially when there is a DEMO
to show exactly how it is done.

Much like I gave away this info too:-

https://forums.macrumors.com/threads/1453193/

And other freebie stuff on here...

Bazza, G0LCU...
 
It is hard to imagine anyone who has ever used the terminal not knowing this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.