I have managed to set up my server with a default user 'admin'. The sshKeys in the metadata is set with the following format, described in the google documentation.
key: sshKeys
value: admin:ssh-rsa XXXXXXXXXX
However, I am trying to add a new user to the system, hence I updated the metadata to the following
key: sshKeys
value: admin:ssh-rsa XXXXXXXXXX newuser:ssh-rsa YYYYYYYYY
This has worked perfectly for me on one instance of server that I have set up sometime back. However I was unable to set it up on the new one. Can someone help me out with this?
To add users to the system, I removed changed the sshKeys
metadata back to the original one, comprising values for only one user:
key: sshKeys
value: admin:ssh-rsa XXXXXXXXXX
Logged into the admin account, and added the new user using useradd
command or whichever applicable to your own Linux distribution.
Under /home/newuser
, I ran the following commands to create a new ssh folder (with reference from .ssh directory not being created)
mkdir ~/.ssh
chmod 700 ~/.ssh
After which, I manually updated the ssh keys in the authorized_keys file location at /home/newuser/.ssh/authorized_keys
and everything works perfectly!