Up until now I had to repeat to type what it seems to be impossible to memorize whenever I need to log into my company’s EC2 account. But, there’s a better way:
1st off, copy your RSA public key into your Mac’s clipboard.
1 | cat ~/.ssh/id_rsa.pub | pbcopy |
2ndly, log in to your EC2 account.
1 | ssh -i hongcode.pem passin.kr -l ubuntu |
finally, you can now go back to your remote server, and open the following file and paste your key there.
1 | vim ~/.ssh/authorized_keys |
Now that you can login to the account by typing `ssh ubuntu@hongcode.com`. We can improve it further here.
1 | vim ~/.ssh/config |
Then, copy the following entries into the file.
1 2 3 | Host passinHostName passin.krUser ubuntu |
Then, you can login into the server by just typing `ssh passin`. you can use the same settings for scp and sftp like this;
1 | scp -r ./somedirs passin:/home/ubuntu |
Cool!
