在终端成为root?sudo bash 与 root #
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23174331/
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
becoming root in terminal? sudo bash vs root#
提问by stackoverflowed
I'm attempting to install the bottle framework for python from the mac terminal. I'm following a MongoDB University video that says I need to be "root" in order to install the program. However, the video starts at the point where the instructor is already root so it doesn't show how he did it.
我正在尝试从 mac 终端为 python 安装 Bottle 框架。我正在关注 MongoDB 大学的视频,该视频说我需要成为“root”才能安装该程序。但是,视频从教师已经是 root 的地方开始,因此它没有显示他是如何做到的。
The instructors screen shows root# and when he types whoami it shows root. I tried to type sudo root#(which asks me for a password and then says command not found) and root#. Neither one works. When I type sudo bash, I'm able to do whoami root.
教师屏幕显示 root#,当他输入 whoami 时,它显示 root。我试图输入 sudo root#(它要求我输入密码,然后说找不到命令)和 root#。一个都不行。当我输入 sudo bash 时,我可以执行 whoami root。
Is sudo bash the same as root#?
sudo bash 和 root# 一样吗?
回答by merlin2011
There is no command called root#
, which is why it says "Command not found". There are multiple ways to get an interactive root shell, but root#
is not one of them.
没有名为 的命令root#
,这就是为什么它说“找不到命令”的原因。有多种方法可以获得交互式 root shell,但root#
不是其中之一。
sudo bash
- type your own passwordsudo -i
- type your own passwordsudo su
- type your own passwordsu
- type the root password.ssh root@localhost
- type the root password.
sudo bash
- 输入您自己的密码sudo -i
- 输入您自己的密码sudo su
- 输入您自己的密码su
- 输入根密码。ssh root@localhost
- 输入根密码。
Note that all the places where I said "type your own password" do not require a password if you have the following line in your sudoers
file:
请注意,如果您的sudoers
文件中有以下行,我说“输入您自己的密码”的所有地方都不需要密码:
<my_User_name> ALL=(ALL:ALL) NOPASSWD: ALL