How to give other people access to an instance¶
These instructions will describe how to share direct ssh access to an instance with another person. Note that this process works for one instance user at a time (e.g. ubuntu
).
Receive their public ssh key¶
The first step to allow another person access to an instance is to receive a public ssh key from them. If they're unfamiliar with creating ssh keys, or if they need to create a new pair specifically for this context, they can follow the instructions here.
Once the person has generated their keypair, direct them to send you their public ssh key in a text file. The contents of public ssh key should have this form:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6D3RuR2j6BvVy6I3Q1amScKYFs+qmI5D37bS9/vgdUvbQx0CnkyuAsx7UpPltXTz3+jkIcGJQqZJUZV1v00/y4iiaHTzp/PxRMT8bzIMw9cOnfZxhSQ1ekUr+wTfT8e5Hs+NabP4bfni/htE7LBk+Mrywgb5I4Mr3fKmKGH4DJzh2YUCt6oC/TivxuKYVrQPEy0BznFuwrHbpQoT6swUa3GaB5nIi/nPyHd6E/EIZ1be+U2y7+efmY9JlQKLaJg6iYumSbibLBQ8qw+ohHbcSBhDUmEiOosuYtvv8L8r3Bvj+2zyFU5DdArSvIPFQbma3/s9oqfYctcqGzVRmFeeJ
Danger
Private keys should never be shared or transferred from the machine where they were generated. Public ssh keys may be transferred or shared. Public ssh keys should have the file extension .pub
and can be viewed by running cat ~/.ssh/id_rsa.pub
. If you have any questions, please contact Science IT.
Add the public key to the authorized_keys
file¶
Once you have received the public key from the person who will access the instance, you must add it to the ~/.ssh/authorized_keys
file on your instance.
At any time, you can view the current contents of the ~/.ssh/authorized_keys
file by running this command from your instance :
cat ~/.ssh/authorized_keys
By default, the file will contain the public ssh key of the person who created the instance.
See the relevant section about Add the public SSH key to the authorized_keys
file for instructions.
Verify a new public ssh key¶
Once you have added another public ssh key to the authorized_keys
file, they should be able to access the instance as described in the Training Handout.
To verify that the ssh login works with the new key pair, confirm that you can access your instance via ssh from a client:
ssh -i ~/.ssh/key user@ipaddress
Info
Access to ScienceCloud virtual machines is, by default, restricted to users on the UZH campus networks or using the UZH VPN.