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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 11:26:55  来源:igfitidea点击:

Arch Linux sudo: command not found

bashraspberry-pirootsudoarchlinux

提问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 rootand executed pacman -S sudo. This was followed by a long output and a confirmation of installation. Following this, I retried to use sudoboth as rootand 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. 随后是很长的输出和安装确认。在此之后,我重新尝试使用sudoasroot和 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 sudopackage to use sudo:

首先,您需要安装sudo要使用的软件包sudo

pacman -S sudo

After you need to edit the sudoersfile and add your username to it.

在您需要编辑sudoers文件并将您的用户名添加到其中之后。

回答by Phillipus

You can add yor user to the wheel group using usermod -G wheel yourusernameand uncomment the %wheel ALL=(ALL) ALLline in the sudoers file. For more information, have a look at Sudo - ArchWiki

您可以使用usermod -G wheel yourusername并取消注释%wheel ALL=(ALL) ALLsudoers 文件中的行将您的用户添加到 wheel 组。有关更多信息,请查看Sudo - ArchWiki