-bash: sudo: 命令未找到

use*_*593 127 debian su sudo apt

我正在尝试部署 django 应用程序。当我打印时, apt-get update 我看到

W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (13: Permission denied)
W: Unable to read /etc/apt/sources.list.d/ - DirectoryExists (13: Permission denied)
W: Unable to read /etc/apt/sources.list - RealFileExists (13: Permission denied)
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
E: Unable to read /var/cache/apt/ - opendir (13: Permission denied)
E: Unable to read /var/cache/apt/ - opendir (13: Permission denied)
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Run Code Online (Sandbox Code Playgroud)

当我打印时, sudo apt-get update 我看到

-bash: sudo: command not found
Run Code Online (Sandbox Code Playgroud)

我尝试使用su而不是sudo. 但很奇怪。例如我打印su apt-get update 并且什么也没发生我只是看到一个新行,

(uiserver):u78600811:~$ su apt-get update
(uiserver):u78600811:~$
Run Code Online (Sandbox Code Playgroud)

如果我尝试安装一些软件包也是如此。我该怎么办?

如果它是有用的信息 - 我正在使用 Debian

(uiserver):u87600811:~$ uname -a
Linux infong1559 3.14.0-ui16294-uiabi1-infong-amd64 #1 SMP Debian 3.14.79-2~ui80+4 (2016-10-20) x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

Mak*_*zik 169

默认情况下 sudo 未安装在 Debian 上,但您可以安装它。首先启用su模式:
su -

通过运行安装 sudo:
apt-get install sudo -y

之后,您需要处理用户和权限。将 sudo 权限授予您自己的用户。

usermod -aG sudo yourusername

确保您的 sudoers 文件添加了 sudo 组。运行:
visudo修改 sudoers 文件并将以下行添加到其中(如果缺少):

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
Run Code Online (Sandbox Code Playgroud)

您需要重新登录或完全重启设备才能使更改生效。

  • 这应该被接受,这解决了我的问题 (4认同)
  • 如果出现“找不到软件包”错误,请先运行“apt-get update”。然后`apt-get install sudo`。 (3认同)

小智 19

由于它是商业服务器,您将无法访问 root 帐户,也无法使用 root 权限进行操作。这意味着您将无法运行sudo或安装软件包。您可以尝试做的是:

  • 检查您是否可以访问编译器并为自己和在您的家庭空间编译您想要的内容。

  • 检查是否可以运行虚拟机。这可能让您运行您将在其上安装软件包的操作系统的私有实例。


Dop*_*oti 13

susudo是两个不同但相关的命令。不sudo安装是不寻常的,但它可能根本不在您的路径中。试试/usr/bin/sudo command

如果确实sudo不可用,您需要按照您推测的方式使用su,但它的工作方式与sudo. 使用它的最简单方法是简单地运行:

su -
Run Code Online (Sandbox Code Playgroud)

这将询问您root用户的密码,此时您可能应该apt install sudo退出 root shell,然后照常进行。

请注意,不同的是sudo,它会询问您密码,而su会询问您root的密码。

  • 那你可能已经是root了。用`whoami`检查。如果您是 root 用户,请按照说明进行 `apt install sudo`。 (4认同)