更改/设置 gcloud os 登录用户名?
change / set gcloud os login username?
这么简单的问题。
我正在向我的计算引擎添加一个新帐户。
我已经添加了用户和角色以及所有有趣的东西。
现在我想添加 ssh 密钥,我通过 运行 gcloud compute os-login ssh-keys add --key-file .....
这很好用,它创建了正确的信息和类似的一切,我可以使用 ssh 正确登录,但是,用户名真的很长而且很烦人。我知道它是由电子邮件地址生成的,但这非常丑陋,每次我需要做一些基于用户名的事情时,输入起来真的很烦人。
有没有办法改变这个,所以它不是ext_matthias_email_com
而是matthias
而不需要将'ssh key'作为元数据添加到服务器?
谢谢大家
在使用 OS 登录时,您可以使用 username
而不是 username_domain.com
您的 G Suite 组织,并且如果您是个人客户则无法更改。
通常,如果您遵循文档 Setting up OS Login,在启用 OS 登录后,您将得到如下内容:
$ gcloud compute ssh os-login-instance-1
...
username_domain_com@os-login-instance-1:~$ whoami
username_domain_com
正如预期的那样,完整的电子邮件地址已转换,所有点和特殊字符都根据 documentation 替换为下划线 ,主要原因是 唯一性:
If a username is not set by a G Suite administrator, OS Login
generates a default Linux username by combining the username and
domain from the email associated with the user's Google profile. This
naming convention ensures uniqueness. For example, if the user email
associated with the Google profile is user@example.com
, then their
generated username is user_example_com
.
username@domain.com becomes -> username_domain_com
要根据 documentation 将 username_domain_com 更改为用户名,您应该拥有 G Suite 组织:
G Suite organizations can optionally change their default to remove
the domain suffix for newly generated usernames. For example, if the
user email associated with the Google profile is user@example.com
,
then their generated username is user
. For more information, see
Managing the OS Login API.
Here 您可以找到更多详细信息,了解它为何以这种方式工作:
OS Login ties your Linux user account to your Google identity so that
you have a consistent username, UID, and other posix information, in
every VM you log into. This allows the VM to authorize your login
using IAM permissions so that you can easily revoke access. The
posix information is immutable for consumer identities (non-G Suite
users). This prevents a bad actor from setting information in a
malicious way that a project owner cannot manage. In order to prevent
uniqueness conflicts across different organizations (user@gmail.com
and user@example.com
) the domain name is included by default.
这么简单的问题。
我正在向我的计算引擎添加一个新帐户。
我已经添加了用户和角色以及所有有趣的东西。
现在我想添加 ssh 密钥,我通过 运行 gcloud compute os-login ssh-keys add --key-file .....
这很好用,它创建了正确的信息和类似的一切,我可以使用 ssh 正确登录,但是,用户名真的很长而且很烦人。我知道它是由电子邮件地址生成的,但这非常丑陋,每次我需要做一些基于用户名的事情时,输入起来真的很烦人。
有没有办法改变这个,所以它不是ext_matthias_email_com
而是matthias
而不需要将'ssh key'作为元数据添加到服务器?
谢谢大家
在使用 OS 登录时,您可以使用 username
而不是 username_domain.com
您的 G Suite 组织,并且如果您是个人客户则无法更改。
通常,如果您遵循文档 Setting up OS Login,在启用 OS 登录后,您将得到如下内容:
$ gcloud compute ssh os-login-instance-1
...
username_domain_com@os-login-instance-1:~$ whoami
username_domain_com
正如预期的那样,完整的电子邮件地址已转换,所有点和特殊字符都根据 documentation 替换为下划线 ,主要原因是 唯一性:
If a username is not set by a G Suite administrator, OS Login generates a default Linux username by combining the username and domain from the email associated with the user's Google profile. This naming convention ensures uniqueness. For example, if the user email associated with the Google profile is
user@example.com
, then their generated username isuser_example_com
.
username@domain.com becomes -> username_domain_com
要根据 documentation 将 username_domain_com 更改为用户名,您应该拥有 G Suite 组织:
G Suite organizations can optionally change their default to remove the domain suffix for newly generated usernames. For example, if the user email associated with the Google profile is
user@example.com
, then their generated username isuser
. For more information, see Managing the OS Login API.
Here 您可以找到更多详细信息,了解它为何以这种方式工作:
OS Login ties your Linux user account to your Google identity so that you have a consistent username, UID, and other posix information, in every VM you log into. This allows the VM to authorize your login using IAM permissions so that you can easily revoke access. The posix information is immutable for consumer identities (non-G Suite users). This prevents a bad actor from setting information in a malicious way that a project owner cannot manage. In order to prevent uniqueness conflicts across different organizations (
user@gmail.com
anduser@example.com
) the domain name is included by default.