How do I login (in the terminal) as the administrative user?

How do I login (in the terminal) as the administrative user? I am running as user and am trying to use a sudo command in the terminal. My administrative password is not accepted. Running OS 10.14.


BTW: Same question as that one from RJLJP posted on Nov 12, 2018 6∶45 PM


All answers weren't useful, unfortunately. Seems I need the root password, which I don't know.


[Re-Titled by Moderator]










iMac 27", macOS 10.14

Posted on Dec 7, 2019 12:28 PM

Reply
35 replies

Dec 8, 2019 7:56 AM in response to leroydouglas

leroydouglas Dec 7, 2019 6:28 PM in response to hexerik:

"If you are admin, the way I become root, simply copy and paste:

sudo -s

To verify where you are, copy and paste:

whoami

"

This doesn't work for me on MacOS 10.14 (Mojave). sudo asks for the root password, which I don't know:


That's why I reopened this old question by RJLJP posted on Nov 12, 2018 6∶45 PM.


"I don't know if this gets you any closer or not, or resolves your issue(?)"

Unfortunately not, sorry. But thanks for trying to help!

Dec 8, 2019 1:53 PM in response to MrHoffman

MrHoffman on Dec 8, 2019 11:01 AM in response to hexerik: "Have you tried this same sudo with a fresh Mojave install?"

Yes, I did. In rootless state as well as after disabling SIP. Sure, I'm administrator on my system, I can do anything what's necessary, but I can't become root because I don't know its password. Actually it isn't necessary - it just annoys me that it won't work. And of course I'm not allowed to change the root password in the Directory Services:



Dec 9, 2019 8:55 AM in response to etresoft

etresoft wrote:

I have no idea what you are trying to do. The behaviour of the su and sudo commands has not changed in many years. It seems that every time someone attempts to pin you down and get you to explain exactly what you are trying to accomplish with the sudo command, you flip and start talking about the su command instead. They are different commands.

I know. But both ask for the (root) password which I don't know. None of the passwords which are used on my system (user & administrator) are accepted.


My advice to restore your system to its factory configuration still stands. I don’t know what you’ve done to it trying to get commands to work in some way that they were never designed to work.

Weren't sudo & su never designed to work?


At this point, any valid command could fail because you have damaged your configuration.


NO - it still works fine!


This is the way things are supposed to work.
If you need to run a command as root, you run “sudo <cmd>“. If you want to just be root for a while, run a shell with sudo via “sudo bash”.

If you want to change your login session to another user, then you would do “su <username>“. For example, I normally run with as a standard user. If I want to use sudo, I have to su to an admin user and then run sudo.


Good. You probably know your root password.


However, su may not work if you are trying to su into a disabled account. It depends on the system configuration. In this respect, macOS behaves identically to any previous version, or to any version of Linux, or even to Sun. If you just categorically refuse to run the correct command ...

Which one? Can you tell me?


... want to reconfigure the system, then go for it.

I do not want to reconfigure the system - I'd just like to run su or sudo - for no particular purpose BTW, actually it isn't necessary, because I've got any access right an administrator is entitled to. Just wanted to know if anybody here has had the same experience, and how it could possibly be solved.


No one here will be able to help you.

Seems so. The only guy(s) who could help can't do this in this forum, with very good reason which I understand well.


Follow the instructions in this Apple support article to enable the root user: https://support.apple.com/HT204012
Then maybe su will work the way you want.

Thanks again. Already tried - doesn't work anymore. Seems this support article is outdated (Nov-17) and doesn't fit any more for Mojave and later versions - s. my response to MrHoffman on Dec 8, 2019 7-34 AM.


Dec 7, 2019 1:27 PM in response to hexerik

Thanks, that obviates certain fundamental concerns. Everything so far indicates that Mac is working perfectly.


I'm not going to ask why you want to modify the sudoers file; that's your business. The bad news is that I am reluctant to provide explicit instructions for the simple reason this site's Hosts will become justifiably nervous, and are 100% certain to nuke those replies if not this entire Discussion.


To cite a trivial example, instructions for disabling SIP (which can be found all over the place) are often removed as contrary to this site's Terms of Use. I have had some removed for that reason, while others remain, but that's beside the point. Forget whether or not it's justified, imagine the response discussing hacking macOS will elicit—and yes, what you propose amounts to hacking macOS.


I sincerely hope you understand the limitations of using this site for that kind of discussion, and ASC is only becoming more restrictive. There are others where you'll get the assistance you need. Thanks for understanding.

Dec 7, 2019 2:20 PM in response to John Galt

Yeah, I think I understand what you want me to tell. May be it's not the right place to discuss such wishes.


I am working alone on my computer, so I'm used to be root on the system whenever necessary. This was always possible - from Tiger to High Sierra - but not now on Mojave, don't mention Catalina. I even don't have the necessity to become root on Mojave - so far - I just find it infuriating that I can't become root any more on my very own computer. I always can switch back to High Sierra.


Of course I know ways how to run visudo and change sudoers (e.g.) even in my MacOS 10.14 installation - but that probably wouldn't even help to become root, because the necessary authorization meanwhile is done elsewhere. But still can't run sudo. :-(( Understood: let it be - at least in this place. Thank you, John! May be I'll try the others.


John Galt wrote:

Thanks, that obviates certain fundamental concerns. Everything so far indicates that Mac is working perfectly.

I'm not going to ask why you want to modify the sudoers file; that's your business. The bad news is that I am reluctant to provide explicit instructions for the simple reason this site's Hosts will become justifiably nervous, and are 100% certain to nuke those replies if not this entire Discussion.

To cite a trivial example, instructions for disabling SIP (which can be found all over the place) are often removed as contrary to this site's Terms of Use. I have had some removed for that reason, while others remain, but that's beside the point. Forget whether or not it's justified, imagine the response discussing hacking macOS will elicit—and yes, what you propose amounts to hacking macOS.

I sincerely hope you understand the limitations of using this site for that kind of discussion, and ASC is only becoming more restrictive. There are others where you'll get the assistance you need. Thanks for understanding.


Dec 7, 2019 6:22 PM in response to hexerik

Load Linux or BSD. Apple is headed away from the direction that you want here. You’re likely going to have increasing difficulties with the path you’re on with root and SIP disabled, with macOS.


Use of root is an old approach and one increasingly viewed as problematic; a lack of auditing, among other issues. Other Unix distros are headed away from allowing root logins here, too. Last I checked, Ubuntu didn’t create a root user by default.


As for your question, may I presume y’all have met the following article?

How to enable the root user on your Mac or change your root password - Apple Support


But as was mentioned in earlier replies, root is increasingly blocked:

About System Integrity Protection on your Mac - Apple Support


Dec 8, 2019 7:34 AM in response to MrHoffman

MrHoffman Dec 7, 2019 6:22 PM in response to hexerik:


"As for your question, may I presume y’all have met the following article?

How to enable the root user on your Mac or change your root password - Apple Support"


Sure, however I guess it's outdated (Published Date: November 28, 2017) resp. obsolete for Mojave, at least it won't work for me here (root-services shown grayed).


"About System Integrity Protection on your Mac - Apple Support"

Yes, I know this one, too: "System Integrity Protection restricts the root user account and limits the actions that the root user can perform on protected parts of the Mac operating system." That's why I've disabled SIP.


Always been a UNIX guy, that's why I want to be root on my system.

Dec 8, 2019 7:34 PM in response to hexerik

I have no idea what you are trying to do. The behaviour of the su and sudo commands has not changed in many years. It seems that every time someone attempts to pin you down and get you to explain exactly what you are trying to accomplish with the sudo command, you flip and start talking about the su command instead. They are different commands.


My advice to restore your system to its factory configuration still stands. I don’t know what you’ve done to it trying to get commands to work in some way that they were never designed to work. At this point, any valid command could fail because you have damaged your configuration.


This is the way things are supposed to work.

If you need to run a command as root, you run “sudo <cmd>“. If you want to just be root for a while, run a shell with sudo via “sudo bash”. If you want to change your login session to another user, then you would do “su <username>“. For example, I normally run with as a standard user. If I want to use sudo, I have to su to an admin user and then run sudo.


However, su may not work if you are trying to su into a disabled account. It depends on the system configuration. In this respect, macOS behaves identically to any previous version, or to any version of Linux, or even to Sun. If you just categorically refuse to run the correct command and want to reconfigure the system, then go for it. No one here will be able to help you.


Follow the instructions in this Apple support article to enable the root user: https://support.apple.com/HT204012

Then maybe su will work the way you want.

Dec 7, 2019 12:47 PM in response to hexerik

hexerik wrote:

How do I login (in the terminal) as the administrative user? I am running as user and am trying to use a sudo command in the terminal. My administrative password is not accepted. Running OS 10.14.

BTW: Same question as that one from RJLJP posted on Nov 12, 2018 6∶45 PM

All answers weren't useful, unfortunately. Seems I need the root password, which I don't know.


What are you trying to accomplish?


Did you try logging into your admin account?


Dec 7, 2019 1:06 PM in response to hexerik

sudoers has restrictions such that you shouldn't even be able to read it without superuser privileges. Modifying it will outlast macOS updates and perhaps even upgrades. Be advised that modifying it from its default configuration will allow anyone to alter macOS on that Mac, for whatever purpose that may entail. I presume you know the implications of that.


Start at the beginning: are you able to even read the file?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I login (in the terminal) as the administrative user?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.