Wednesday, September 10, 2014

Login to remote server with private key

1. Generate private/public keys
   ssh-keygen -t rsa

2. Upload the public key ( to remote server
   scp ~/.ssh/ howard@remoteServer:~/.ssh/
   cat ~/.ssh/ | ssh howard@remoteServer "cat >> ~/.ssh/authorized_keys" 

3. Login to remote server and append the key
   ssh howard@remoteServer
   mkdir .ssh
   chmod 700 .ssh
   cat ~/.ssh/ >> ~/.ssh/authorized_keys
   chmod 600 ~/.ssh/authorized_keys
   rm -rf

4. It's done!

To convert RSA private key to pem file, run the command below:
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem

No comments:

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX