Sudo su

Joined
Jul 15, 2009
Messages
211
Reaction score
0
Points
16
Location
In front of MY MAC OR LINUX BOX
Your Mac's Specs
Mac Pro Workstation Airport Extreme ATV 2 Ipad
If this is not the correct forum to ask this question I apologize .
I have set up my system in that I am admin.
But still if try to update or something like that it ask me for my password with is good.
But if I open a terminal and give the command sudo su enter and than whoami the answer is root.
That means that I can do anything on the command line without entering a password .
I find that strange .
Can I change it in that way that it ask for a password before I become root ?

Tanks in advance
dobby
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
I'm no master of the UNIX shell, but I think it's telling you that you're root because you prefaced "su" with sudo. When you run anything under sudo, you're root - and you have to authenticate the first time you do it. You'll find that if you don't preface something with sudo, you're an every day user.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
the command su will automatically assume root user if you do not specify a user. This is true of all *nix's out there. If you had done something like..

sudo foouser

you'd get
mikeMbp:Caches mike$ whoami
foouser

If you want to run as a non-priv'd user and run priv'd commands don't su, there's no reason to (su is Switch User). Just sudo <command>. Once you're root the OS assumes you're ALWAYS right. Which has gotten a lot of people in trouble :D Even most unix admin's won't log in as root without reason.. it's too easy to fingercheck.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top