macos OSX su 命令问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7565042/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:28:30  来源:igfitidea点击:

OSX su command issue

macososx-lionsu

提问by kapso

So I cant get sucommand to work on a terminal. All I do is type "su" and press enter, it asks for the password and I enter my currently logged in user password. It always gives this error. I swear this used to work earlier, not sure what happened.

所以我无法获得su在终端上工作的命令。我所做的就是输入“su”并按回车键,它会要求输入密码,然后我输入我当前登录的用户密码。它总是给出这个错误。我发誓这曾经有效,不知道发生了什么。

su: Sorry

I am running a Mac OSX 10.7.1 (Lion). Anyone know what could be wrong? I am entering the right password.

我正在运行 Mac OSX 10.7.1 (Lion)。任何人都知道什么可能是错的?我正在输入正确的密码。

回答by Nehemias Herrera

sudo su

will do the trick in Mac Os X terminal :)

将在 Mac Os X 终端中完成任务 :)

回答by Hymanlol

There is no root account on mac osx. Just go sudo bashthen type the command or commands you want as root.

mac osx 上没有 root 帐户。只需转到sudo bash然后以 root 身份键入您想要的一个或多个命令。

回答by schluchc

If sudo stops working because permission to read sudoers is missing, this solution from kahisv.comsolves the problem:

如果 sudo 由于缺少读取 sudoers 的权限而停止工作,则来自kahisv.com 的此解决方案可以解决问题:

Check if the permissions are still correct, that's how it should be:

检查权限是否仍然正确,应该是这样:

$ ls -lad / /private /private/etc
d--xrwxr-t+  36 root  wheel  1292 25 sty 12:34 /

If this is wrong in your case, boot in Single-User Mode (hold cmd+s while booting) and enter theese commands:

如果这是错误的,请以单用户模式启动(启动时按住 cmd+s)并输入以下命令:

# /sbin/fsck -fy
# /sbin/mount -wu /
# /bin/chmod 1775 /
# /bin/sync
# exit