0

we have created the VM instance on GCP and Google assigned the default user xx we have configured the ssh key we are able to log in without a password and added the new group Sftp yy and added user zz to group unable to do password less ssh and sftp with new user

  • 1
    SSH keys don't regulate access to a server, they regulate access to a specific account on that server. Authorized keys need to be set up for each account separately. – HBruijn Jul 14 '23 at 09:54

1 Answers1

2

If I understand you description correctly you want to be able to password-less ssh zz@vm.dom (which would also allow password-less sftp as user zz) where vm.dom is the address (or fqdn) of the GCP vm.

To allow that you simply need to add the public ssh-key you use to the new users ~/.ssh/authorized_keys on the vm and make sure the permissions are set correctly.

As zz on the vm you could:

test -d ~/.ssh || mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
cat publickey-file >> ~/.ssh/authorized_keys
fraxflax
  • 76
  • 6