简体   繁体   English

Google Compute Engine 实例需要 sudo 密码 - 我的密码是什么?

[英]Google Compute Engine instance requires password for sudo - what is my password?

I have a new google compute engine instance.我有一个新的谷歌计算引擎实例。 I am SSH'ed into the instance using certs.我使用证书通过 SSH 连接到实例。 Whenever I try to use sudo it asks for the primary user's password which I do not have.每当我尝试使用 sudo 时,它都会询问我没有的主用户密码。 Just recently I setup an instance on centos 7 and did not have this issue.就在最近,我在 centos 7 上设置了一个实例,但没有遇到此问题。

The instance is running centos 8. Normally, I would ssh to the instance, then execute commands using Sudo.该实例正在运行 centos 8。通常,我会将 ssh 到该实例,然后使用 Sudo 执行命令。 For example, I would like to set the root password.例如,我想设置root密码。

if I run sudo passwd , sudo su - or even sudo cat /var/log/messages it asks me for the primary user's password.如果我运行sudo passwdsudo su -甚至sudo cat /var/log/messages它会询问我主用户的密码。 The problem is I do not have that password.问题是我没有那个密码。

[primaryuser@server4 log]$ **sudo cat messages** 

**[sudo] password for primaryuser:** 

##########

[primaryuser@server4 log]$ **sudo passwd**

**[sudo] password for primaryuser:** 

I expected to run the commands using sudo but do not have the password.我希望使用 sudo 运行命令,但没有密码。

Does anyone have any ideas?有没有人有任何想法? I read other posts about similar problems but different from mine.我读过其他关于类似问题但与我不同的帖子。

I had to give up and use ubuntu.我不得不放弃并使用 ubuntu。 Everything acted as expected on ubuntu and I was able to set the password. ubuntu 上的一切都按预期运行,我能够设置密码。 I believe the problem is limited to centos 8 but I am not certain.我相信问题仅限于 centos 8 但我不确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM