sudoing时要求密码的Google Cloud VM [英] Google Cloud VM when sudoing asks for password

查看:133
本文介绍了sudoing时要求密码的Google Cloud VM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been working with a Google Cloud debian VM and had no problem at all doing super user tasks using sudo (sudo was not asking for password).

今天,我像往常一样通过SSH连接,当我尝试 sudo某物 时,它开始要求输入密码:

Today I connected via SSH as usual and when I try to sudo something it started asking for password:

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密钥身份验证。

According to the documentation it should not ask for password as is already SSL Key authenticated connection.

推荐答案

我自己解决了此问题。我为有类似问题的任何人发布了我遵循的步骤:

I have solved this issue by myself. I post the steps i've followed for anyone who has a similar problem:


  1. 删除VM 实例保留

  2. 创建了用于恢复目的的新VM实例

  3. 附加了旧的VM磁盘到新实例

  4. 安装到/ mnt /

  1. Deleted the VM instance preserving the disk.
  2. Created new VM instance for recovering pruposes.
  3. Attached the old VM disk to the new instance
  4. Mounted into /mnt/

# mount /dev/sdb1 /mnt/


  • 将root更改为已挂载的分区

  • Change root to mounted partition

    # chroot /mnt/
    


  • 现在根据需要编辑sudoers文件以及用户密码和组

  • 卸载磁盘

  • Now edit the sudoers file and the user password and group as needed
  • Unmount the disk

    # umount /dev/sdb1
    


  • 断开连接磁盘,删除恢复实例,然后使用相同的磁盘重新创建旧的VM

  • deattach the disk, delete the recovery instance, and recreate the old VM with the same disk
  • 这篇关于sudoing时要求密码的Google Cloud VM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆