“ -bash:sudo:未找到命令”对于Linux,Debian,CentOS的错误和解决方案

sudo  command is used to execute command as another user. This is generally used to run command as root. In some cases we can get an error like -bash:sudo:command not found which means sudo is not installed. In this tutorial we will look different ways and distributions to solve this problem.

sudo命令用于以另一个用户身份执行命令。 通常用于以root身份运行命令。 在某些情况下,我们会收到-bash:sudo:command not found类的错误,这意味着未安装sudo 。 在本教程中,我们将探讨解决此问题的不同方式和分布。

为Debian,Ubuntu,Mint,Kali安装Sudo (Install Sudo For Debian, Ubuntu, Mint, Kali)

We can install sudo for Debian, Ubuntu, Mint and Kali related distributions for deb or apt with the following command. But before we should be root user because package installation requires root privileges.

我们可以安装sudo适用于Debian,Ubuntu的,薄荷和卡利相关发行debapt使用下面的命令。 但是在我们应该是root用户之前,因为软件包安装需要root特权。

$ su
$ apt install sudo

为CentOS,Fedora,RHEL安装Sudo (Install Sudo For CentOS, Fedora, RHEL)

We can install sudo for CentOS, Fedora and RHEL related distributions for rpm or yum with the following command. But before we should be root user because package installation requires root privileges.

我们可以使用以下命令为rpm或yum安装与CentOS,Fedora和RHEL相关的发行版的sudo 。 但是在我们应该成为root用户之前,因为软件包安装需要root特权。

$ su
$ yum install sudo

添加用户Sudoers配置文件 (Add User Sudoers Configuration File)

sudo command provides fast way to change root user. But this is done with a configuration file locate /etc/sudoers . sudoers file contains users and their ability to run sudo command. Most of the distributions automatically adds user to this file but in some cases this may fail. We can add following line to make user able to run sudo . In this example we will use user name ismail

sudo命令提供了更改root用户的快速方法。 但这是通过配置文件locate /etc/sudoerssudoers文件包含用户及其运行sudo命令的能力。 大多数发行版会自动将用户添加到该文件,但是在某些情况下,这可能会失败。 我们可以添加以下行以使用户能够运行sudo 。 在此示例中,我们将使用用户名ismail

ismail        ALL=(ALL)  ALL

成为另一个用户 (Become Another User)

While using sudo if we need to change user other than root we should provide the user name after the sudo command . In this example we will change to the user ali

在使用sudo时,如果需要更改root用户以外的其他用户,则应在sudo命令后提供用户名。 在此示例中,我们将更改为用户ali

$ sudo ali
LEARN MORE  How To Give Su Rigth To User In FreeBSD?
了解更多如何在FreeBSD中为用户赋予Su Rigth?

翻译自: https://www.poftut.com/bash-sudo-command-not-found-error-solution-linux-debian-centos/

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值