bash Arch Linux sudo:找不到命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26130427/
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
Arch Linux sudo: command not found
提问by Phillipus
I recently installed Arch Linux on my Raspberry Pi and, after logging in as root and creating myself a user account I tried to use the sudo command. This was the result:
我最近在我的 Raspberry Pi 上安装了 Arch Linux,在以 root 身份登录并为自己创建一个用户帐户后,我尝试使用 sudo 命令。这是结果:
[phillipus@alarmpi home]$ sudo mkdir Public
bash: sudo: command not found
After searching for the problem, I logged in as root
and executed pacman -S sudo
. This was followed by a long output and a confirmation of installation. Following this, I retried to use sudo
both as root
and as my user, both times getting the same response. Following another solution to the problem, I tried to add myself to /etc/sudoers
, only to find out that it didn't exist.
搜索问题后,我以身份登录root
并执行pacman -S sudo
. 随后是很长的输出和安装确认。在此之后,我重新尝试使用sudo
asroot
和 as 我的用户,两次都得到相同的响应。遵循该问题的另一种解决方案,我尝试将自己添加到/etc/sudoers
,却发现它不存在。
I am not very experienced with Linux, so could you please try to explain your responses fully?
我对 Linux 不是很有经验,所以请您尝试完整地解释一下您的回答吗?
回答by mobal
First, you need to install the sudo
package to use sudo
:
首先,您需要安装sudo
要使用的软件包sudo
:
pacman -S sudo
After you need to edit the sudoers
file and add your username to it.
在您需要编辑sudoers
文件并将您的用户名添加到其中之后。
回答by Phillipus
You can add yor user to the wheel group using usermod -G wheel yourusername
and uncomment the %wheel ALL=(ALL) ALL
line in the sudoers file. For more information, have a look at Sudo - ArchWiki
您可以使用usermod -G wheel yourusername
并取消注释%wheel ALL=(ALL) ALL
sudoers 文件中的行将您的用户添加到 wheel 组。有关更多信息,请查看Sudo - ArchWiki