gpt4 book ai didi

debian - sudoing 要求输入密码时的 Google Cloud VM

转载 作者:行者123 更新时间:2023-12-02 15:12:01 32 4
gpt4 key购买 nike

我一直在使用 Google Cloud debian VM,使用 sudo 执行 super 用户任务完全没有问题(sudo 不要求输入密码)。

今天我像往常一样通过 SSH 连接,当我尝试sudo something 它开始询问密码:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for -----:

根据文档,它不应该要求密码,因为已经通过 SSL key 验证连接。

最佳答案

今天我在 CentOS 8.x VM 上遇到了同样的问题。经过一些测试,我找到了一个更简单的解决方案。/etc/sudoers.d/google_sudoers 文件中允许“google-sudoers”组进行 sudo,因此,要解决该问题并使其永久化,请按照以下步骤将您的用户添加到“google-sudoers”组:

  1. 从 GCP 的网络控制台通过 SSH 连接到您的虚拟机
  2. 运行 sudo usermod -a -G google-sudoers USER 将您的 USER 添加到 google-sudoers 组
  3. 关闭当前的 SSH session 并打开一个新 session
  4. 测试一切正常

您应该能够运行 sudo 命令或再次获得 root 权限。

关于debian - sudoing 要求输入密码时的 Google Cloud VM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43266975/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com