LoginSignup
4
2

More than 5 years have passed since last update.

gcloudでユーザー名を指定してログインしたい - $USERを使わせない方法

Last updated at Posted at 2019-01-08

やりたいこと

gcloud compute ... ssh ...するときにユーザー名を指定してインスタンスにログインしたいです。
デフォルトの挙動はホストマシンの$USERでユーザーを見てログインするぽく困っていました。

解決策

明示的にユーザー名を指定する方法は、ユーザ名@インスタンス名というふうにすればOKでした。

以下はコマンド例です。
gcloud compute --project "myproject-xxx" ssh --zone "us-east1-b" "myusername@instance-1"
(太字の箇所を「gcloudコマンドを表示」で出てきたコマンドに追加するだけでした)

参考

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2