+3 votes
518 views
How to enable or disable root user with macOS commands

in Mac by (551k points)
reopened | 518 views

1 Answer

+4 votes
Best answer

1. How to enable the root user using the dsenableroot command
2. How to disable the root user in macOS High Sierra

On UNIX-based operating systems, such as Linux or macOS, there is a root user who has full power over the system, its services and its processes..

This user is disabled by default for security reasons because if this command is executed without due knowledge or responsibility we can cause damage to the system that may be irreparable. Hence the importance that this root user should only be used by administrators or advanced users who are aware of what this can be.

Today in TechnoWikis we will see how to enable or disable this user through the command line..

Terminal Access
To access the terminal we have the following options. Using the key combination Shift + Command + U or on the Go / Utilities path. In the displayed window we will double click on Terminal:

+ ⌘ + U ⇧ + ⌘ + U

image

The next option is using Spotlight and for this we will enter the word terminal and select the respective utility:

image


1. How to enable the root user using the dsenableroot command


To enable the root user using this command the process is simple, for this we execute in the dsenableroot terminal and then we will enter the users password, then enter and verify the root user's password:
 dsenableroot 

image

We will see the message *** Successfully enabled root user which confirms that the enablement has been successful. With this command, it is also possible to enable the root user for a single account in particular, for this we must use the -u parameter:

 dsenableroot -u "User" 

image


2. How to disable the root user in macOS High Sierra


With the -d parameter using the dsenableroot command, the root user will be disabled universally as follows:
 dsenableroot -d 

image

Also, if we want, we can disable the root user for a special user we will execute the following syntax:

 dsenableroot -d -u "user" 
With this simple method we can enable or not this important user in UNIX environments.

by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Nov 14, 2019 in Mac by backtothefuture (551k points) | 262 views
+4 votes
1 answer
asked Oct 30, 2019 in Linux / Unix by backtothefuture (551k points) | 226 views
+4 votes
1 answer
asked Sep 29, 2019 in Mac by backtothefuture (551k points) | 602 views
+3 votes
2 answers
asked Aug 23, 2019 in Mac by backtothefuture (551k points) | 6.9k views
+4 votes
1 answer
asked Oct 11, 2019 in Mac by backtothefuture (551k points) | 198 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users