0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GCP(Google Cloud Platform)Advent Calendar 2022

Day 19

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)【Google Compute Engine】【Rocky Linux】

Last updated at Posted at 2022-12-20

クライアント

ssh-keygen -q -f $HOME/.ssh/id_rsa -P ''
cat $HOME/.ssh/id_rsa.pub

サーバー id_rsa.pubauthorized_keysにコピペ

echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys
rootでログインする場合
echo PermitRootLogin yes >> /etc/ssh/sshd_config
systemctl reload sshd

GCPはSSHが有効になってるため設定は必要ありません
image.png

ユーザーを追加する場合( Debian )
USERNAME=myuser
sudo useradd -m -p '' $USERNAME
sudo usermod -aG sudo $USERNAME
su - $USERNAME

echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys
ユーザーを追加する場合( Rocky Linux )
USERNAME=myuser
sudo useradd -m -p '' $USERNAME
sudo usermod -aG wheel $USERNAME
su - $USERNAME

echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?