GCE-如果我使用SSH或从终端登录,则使用不同的用户名? [英] GCE - different username if i use SSH or log in from terminal?

查看:117
本文介绍了GCE-如果我使用SSH或从终端登录,则使用不同的用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个没有任何内容的新项目.

I created a new project with nothing in it.

创建第一个微型实例时,我做了以下

When I created my first micro instance I did the following

  1. 使用浏览器窗口SSH连接到它. 我看到了:

  1. Connect to it using the browser window SSH. I see:

user_name @ instance-1:〜$

如果我使用gcloud命令进行连接:

If I connect using the gcloud command:

gcloud compute --project"projectname-165421" ssh --zone"us-east1-b""instance-1"

gcloud compute --project "projectname-165421" ssh --zone "us-east1-b" "instance-1"

我被带到:

username @ instance-1:〜$

为什么会这样,我该如何解决?

Why is this happening, and how do I resolve it?

这将创建两个单独的用户,这给我造成了很大的困惑!

This is creating two separate users which is creating a great deal of confusion for me!

谢谢

推荐答案

默认情况下,cloudSDK将尝试使用运行命令的用户进行连接.

By default, the cloudSDK will try to connect using the user running the command.

如果您查看文档, 它说您可以使用默认的ssh客户端来指定用户名.

If you look at the docs, It says you can specify the username like you would, with your default ssh client.

在计算机上的含义:

gcloud compute --project "projectname-165421" ssh --zone "us-east1-b" "user_name@instance-1"

或者,在浏览器窗口SSH中切换用户:

Alternatively, switch user in the browser window SSH:

sudo su username

这篇关于GCE-如果我使用SSH或从终端登录,则使用不同的用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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