Add an ssh key
- Create new key from your local machine (if you don’t have one):
- On Windows:
ssh-keygen
works but it’s fussy
- I named it
id_rsa_test_user
(but then I reverted to my personal id_rsa
!)
- I didn’t use a password
scp
the key to the server
scp -i ~/path/to/do4ds-lab-key.pem ~/path/to/id_rsa.pub ubuntu@@$SERVER_ADDRESS:/home/ubuntu
- On server:
mv
& chown
to user
su test-user
& cd ~
mkdir -p .ssh
, chmod 700 .ssh
, cat id_rsa.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
rm id_rsa.pub