How do I become root on Mac OS X?
I recently started doing Unix and Mac development, coming from a hardcore work environment in .NET. I am learning terminal use and how to mkdir
and ls
and vim
, but it's all under my actual name.
I just bought a MacBook Pro Retina. My Unix account shows my name. But I need to login as root.
I tried this command in terminal to switch to root:
su - root
but it won't take my password, and I really don't know which password to provide?
macos
migrated from stackoverflow.com May 7 '13 at 0:24
This question came from our site for professional and enthusiast programmers.
add a comment |
I recently started doing Unix and Mac development, coming from a hardcore work environment in .NET. I am learning terminal use and how to mkdir
and ls
and vim
, but it's all under my actual name.
I just bought a MacBook Pro Retina. My Unix account shows my name. But I need to login as root.
I tried this command in terminal to switch to root:
su - root
but it won't take my password, and I really don't know which password to provide?
macos
migrated from stackoverflow.com May 7 '13 at 0:24
This question came from our site for professional and enthusiast programmers.
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
2
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely usesudo
instead).
– Kevin
May 6 '13 at 21:36
add a comment |
I recently started doing Unix and Mac development, coming from a hardcore work environment in .NET. I am learning terminal use and how to mkdir
and ls
and vim
, but it's all under my actual name.
I just bought a MacBook Pro Retina. My Unix account shows my name. But I need to login as root.
I tried this command in terminal to switch to root:
su - root
but it won't take my password, and I really don't know which password to provide?
macos
I recently started doing Unix and Mac development, coming from a hardcore work environment in .NET. I am learning terminal use and how to mkdir
and ls
and vim
, but it's all under my actual name.
I just bought a MacBook Pro Retina. My Unix account shows my name. But I need to login as root.
I tried this command in terminal to switch to root:
su - root
but it won't take my password, and I really don't know which password to provide?
macos
macos
edited May 8 '13 at 7:09
slhck
160k47444466
160k47444466
asked May 6 '13 at 21:26
Huang
migrated from stackoverflow.com May 7 '13 at 0:24
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com May 7 '13 at 0:24
This question came from our site for professional and enthusiast programmers.
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
2
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely usesudo
instead).
– Kevin
May 6 '13 at 21:36
add a comment |
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
2
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely usesudo
instead).
– Kevin
May 6 '13 at 21:36
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
2
2
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely use
sudo
instead).– Kevin
May 6 '13 at 21:36
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely use
sudo
instead).– Kevin
May 6 '13 at 21:36
add a comment |
6 Answers
6
active
oldest
votes
You should actually use sudo -i
to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.
To exit the interactive shell, type exit
or ^D
(that's Control-D, not Command-D). You'll then be back in your normal terminal.
Regarding your original question: Use sudo su
.
The su
command grants you access to another user's account, but you need to know that user's password. Since root
is disabled by default (and for good reason), and has no password, you can use sudo
, which grants you elevated privileges for one command, to overrule that rule. When sudo
prompts you for your password:
[sudo] password for huang:
just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.
-1 for the unexplained passive aggression. I have no idea what alternative approach you're sayingsudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're sayingsudo su
is superior tosudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.
– Mark Amery
Jun 20 '18 at 10:55
add a comment |
Just type the following command:
sudo su
add a comment |
This only works if you're an admin user, which you shouldn't be I think. Better create another user with admin rights. Whenever you need admin rights for installing software, you have to enter the login for an admin user.
Let's say you give this new admin user the name "huangadmin". It may be something else (like admin), but I don't think it's a good idea to give it the name "root".
Then, in the terminal, you need to use su huangadmin
. The password for this account is requested, and then you're user huangadmin. Then you can use sudo su
and become root.
add a comment |
very simple command to run as sudo :
sudo -s what_ever_command_you_want
add a comment |
OS Sierra
dsenableroot
More info: How to Enable the Root User on Your Mac
add a comment |
By default root user is disabled on Mac, you need to first enable root user on Mac.
Refer: https://www.dataneb.com/single-post/2018/08/29/How-to-enable-root-user-on-Mac
From top left hand side, choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
Click the lock icon , then enter an administrator name and password.
After you unlock the lock. Click Login Options, right next to home icon.
Now Click Join (or Edit), right next to Network Account Server. Now Click Open Directory Utility.
Click lock icon in the Directory Utility window, then enter an administrator name and password.
From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. You can enable/disable/change password for root user from here.
Now go to Terminal and switch user to root and test.
Once root user password is set in Directory utilities. Type su root in your terminal and enter the password. Note local admin user password is not same as root user.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f592323%2fhow-do-i-become-root-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should actually use sudo -i
to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.
To exit the interactive shell, type exit
or ^D
(that's Control-D, not Command-D). You'll then be back in your normal terminal.
Regarding your original question: Use sudo su
.
The su
command grants you access to another user's account, but you need to know that user's password. Since root
is disabled by default (and for good reason), and has no password, you can use sudo
, which grants you elevated privileges for one command, to overrule that rule. When sudo
prompts you for your password:
[sudo] password for huang:
just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.
-1 for the unexplained passive aggression. I have no idea what alternative approach you're sayingsudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're sayingsudo su
is superior tosudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.
– Mark Amery
Jun 20 '18 at 10:55
add a comment |
You should actually use sudo -i
to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.
To exit the interactive shell, type exit
or ^D
(that's Control-D, not Command-D). You'll then be back in your normal terminal.
Regarding your original question: Use sudo su
.
The su
command grants you access to another user's account, but you need to know that user's password. Since root
is disabled by default (and for good reason), and has no password, you can use sudo
, which grants you elevated privileges for one command, to overrule that rule. When sudo
prompts you for your password:
[sudo] password for huang:
just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.
-1 for the unexplained passive aggression. I have no idea what alternative approach you're sayingsudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're sayingsudo su
is superior tosudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.
– Mark Amery
Jun 20 '18 at 10:55
add a comment |
You should actually use sudo -i
to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.
To exit the interactive shell, type exit
or ^D
(that's Control-D, not Command-D). You'll then be back in your normal terminal.
Regarding your original question: Use sudo su
.
The su
command grants you access to another user's account, but you need to know that user's password. Since root
is disabled by default (and for good reason), and has no password, you can use sudo
, which grants you elevated privileges for one command, to overrule that rule. When sudo
prompts you for your password:
[sudo] password for huang:
just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.
You should actually use sudo -i
to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.
To exit the interactive shell, type exit
or ^D
(that's Control-D, not Command-D). You'll then be back in your normal terminal.
Regarding your original question: Use sudo su
.
The su
command grants you access to another user's account, but you need to know that user's password. Since root
is disabled by default (and for good reason), and has no password, you can use sudo
, which grants you elevated privileges for one command, to overrule that rule. When sudo
prompts you for your password:
[sudo] password for huang:
just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.
answered May 6 '13 at 21:30
wcharginwchargin
6261718
6261718
-1 for the unexplained passive aggression. I have no idea what alternative approach you're sayingsudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're sayingsudo su
is superior tosudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.
– Mark Amery
Jun 20 '18 at 10:55
add a comment |
-1 for the unexplained passive aggression. I have no idea what alternative approach you're sayingsudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're sayingsudo su
is superior tosudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.
– Mark Amery
Jun 20 '18 at 10:55
-1 for the unexplained passive aggression. I have no idea what alternative approach you're saying
sudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're saying sudo su
is superior to sudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.– Mark Amery
Jun 20 '18 at 10:55
-1 for the unexplained passive aggression. I have no idea what alternative approach you're saying
sudo -i
is "actually" better than, or why, and nor do I know what change to the "original" question you're insinuating occurred (presumably inside of the grace period, and thus not appearing in the edit history?). Without those details, this answer is pretty incomprehensible. It sounds like you're saying sudo su
is superior to sudo -i
in some circumstances outlined in a no-longer-accessible revision, which is an obviously unhelpful way to frame the answer for future readers.– Mark Amery
Jun 20 '18 at 10:55
add a comment |
Just type the following command:
sudo su
add a comment |
Just type the following command:
sudo su
add a comment |
Just type the following command:
sudo su
Just type the following command:
sudo su
answered Mar 13 '16 at 23:50
grepitgrepit
1336
1336
add a comment |
add a comment |
This only works if you're an admin user, which you shouldn't be I think. Better create another user with admin rights. Whenever you need admin rights for installing software, you have to enter the login for an admin user.
Let's say you give this new admin user the name "huangadmin". It may be something else (like admin), but I don't think it's a good idea to give it the name "root".
Then, in the terminal, you need to use su huangadmin
. The password for this account is requested, and then you're user huangadmin. Then you can use sudo su
and become root.
add a comment |
This only works if you're an admin user, which you shouldn't be I think. Better create another user with admin rights. Whenever you need admin rights for installing software, you have to enter the login for an admin user.
Let's say you give this new admin user the name "huangadmin". It may be something else (like admin), but I don't think it's a good idea to give it the name "root".
Then, in the terminal, you need to use su huangadmin
. The password for this account is requested, and then you're user huangadmin. Then you can use sudo su
and become root.
add a comment |
This only works if you're an admin user, which you shouldn't be I think. Better create another user with admin rights. Whenever you need admin rights for installing software, you have to enter the login for an admin user.
Let's say you give this new admin user the name "huangadmin". It may be something else (like admin), but I don't think it's a good idea to give it the name "root".
Then, in the terminal, you need to use su huangadmin
. The password for this account is requested, and then you're user huangadmin. Then you can use sudo su
and become root.
This only works if you're an admin user, which you shouldn't be I think. Better create another user with admin rights. Whenever you need admin rights for installing software, you have to enter the login for an admin user.
Let's say you give this new admin user the name "huangadmin". It may be something else (like admin), but I don't think it's a good idea to give it the name "root".
Then, in the terminal, you need to use su huangadmin
. The password for this account is requested, and then you're user huangadmin. Then you can use sudo su
and become root.
answered May 8 '13 at 8:56
SPRBRNSPRBRN
3,19173968
3,19173968
add a comment |
add a comment |
very simple command to run as sudo :
sudo -s what_ever_command_you_want
add a comment |
very simple command to run as sudo :
sudo -s what_ever_command_you_want
add a comment |
very simple command to run as sudo :
sudo -s what_ever_command_you_want
very simple command to run as sudo :
sudo -s what_ever_command_you_want
answered Sep 21 '15 at 22:14
grepitgrepit
1336
1336
add a comment |
add a comment |
OS Sierra
dsenableroot
More info: How to Enable the Root User on Your Mac
add a comment |
OS Sierra
dsenableroot
More info: How to Enable the Root User on Your Mac
add a comment |
OS Sierra
dsenableroot
More info: How to Enable the Root User on Your Mac
OS Sierra
dsenableroot
More info: How to Enable the Root User on Your Mac
answered Jul 24 '17 at 14:56
Isanka WijerathneIsanka Wijerathne
1112
1112
add a comment |
add a comment |
By default root user is disabled on Mac, you need to first enable root user on Mac.
Refer: https://www.dataneb.com/single-post/2018/08/29/How-to-enable-root-user-on-Mac
From top left hand side, choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
Click the lock icon , then enter an administrator name and password.
After you unlock the lock. Click Login Options, right next to home icon.
Now Click Join (or Edit), right next to Network Account Server. Now Click Open Directory Utility.
Click lock icon in the Directory Utility window, then enter an administrator name and password.
From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. You can enable/disable/change password for root user from here.
Now go to Terminal and switch user to root and test.
Once root user password is set in Directory utilities. Type su root in your terminal and enter the password. Note local admin user password is not same as root user.
add a comment |
By default root user is disabled on Mac, you need to first enable root user on Mac.
Refer: https://www.dataneb.com/single-post/2018/08/29/How-to-enable-root-user-on-Mac
From top left hand side, choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
Click the lock icon , then enter an administrator name and password.
After you unlock the lock. Click Login Options, right next to home icon.
Now Click Join (or Edit), right next to Network Account Server. Now Click Open Directory Utility.
Click lock icon in the Directory Utility window, then enter an administrator name and password.
From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. You can enable/disable/change password for root user from here.
Now go to Terminal and switch user to root and test.
Once root user password is set in Directory utilities. Type su root in your terminal and enter the password. Note local admin user password is not same as root user.
add a comment |
By default root user is disabled on Mac, you need to first enable root user on Mac.
Refer: https://www.dataneb.com/single-post/2018/08/29/How-to-enable-root-user-on-Mac
From top left hand side, choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
Click the lock icon , then enter an administrator name and password.
After you unlock the lock. Click Login Options, right next to home icon.
Now Click Join (or Edit), right next to Network Account Server. Now Click Open Directory Utility.
Click lock icon in the Directory Utility window, then enter an administrator name and password.
From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. You can enable/disable/change password for root user from here.
Now go to Terminal and switch user to root and test.
Once root user password is set in Directory utilities. Type su root in your terminal and enter the password. Note local admin user password is not same as root user.
By default root user is disabled on Mac, you need to first enable root user on Mac.
Refer: https://www.dataneb.com/single-post/2018/08/29/How-to-enable-root-user-on-Mac
From top left hand side, choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
Click the lock icon , then enter an administrator name and password.
After you unlock the lock. Click Login Options, right next to home icon.
Now Click Join (or Edit), right next to Network Account Server. Now Click Open Directory Utility.
Click lock icon in the Directory Utility window, then enter an administrator name and password.
From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. You can enable/disable/change password for root user from here.
Now go to Terminal and switch user to root and test.
Once root user password is set in Directory utilities. Type su root in your terminal and enter the password. Note local admin user password is not same as root user.
edited Sep 11 '18 at 16:51
Worthwelle
2,68531125
2,68531125
answered Sep 11 '18 at 16:27
Hina SinghHina Singh
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f592323%2fhow-do-i-become-root-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
try sudo su - root You probably just want to run things with sudo instead of actually switching to root.
– Shawn Balestracci
May 6 '13 at 21:28
root isn't enabled on mac by default why do you need to be root?
– FDinoff
May 6 '13 at 21:28
If you are running linux on that macbook pro (which works perfectly fine) you should be able to use that command. However it requires the root password, not yours, since you have to prove that you are indeed permitted to act as that root user.
– arkascha
May 6 '13 at 21:30
2
I've worked on mac and Linux for many years and I have very rarely needed to log in as root. Tell us what you're trying to do, and we'll tell you a better way (most likely use
sudo
instead).– Kevin
May 6 '13 at 21:36