HOWTO: connect to VPS from AWS through ssh

1. create new instance

2. go to account, add new ssh key pair (download it)

3. create static ip address for the new instance

3.change permissions to read only:

chmod 400 mykey.pem

4.create public key from private key:

ssh-keygen -y -f mkey.pem \>

5. connect to the VPS over ssh:

ssh -i mkey.pem ubuntu@ip-address

6. create new user

sudo add user mmuster

7. add user to sudoers

sudo visudo

8. fill the line

# User privilege specification
mmuster ALL=(ALL:ALL) ALL

9. add user to sudoers group

sudo adduser mmuster sudo

10. impersonate mmuster

sudo su mmuster

11. change to home dir of mmuster


12. create .ssh directory

mkdir .ssh

13. change rights

chmod 700 .ssh/

14. change to .ssh

cd .ssh

15. !from another terminal! print the public key — .pub


16. copy the content


17. !back to the terminal on VPS on AWS! create authorized_keys

touch authorized_keys

18. open the authorized_keys and paste the content

vim authorized_keys

19. connect as the new user

ssh -i mkey.pem mmuster@ip

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.