Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication without password using OpenSSH Key, certificates .pem and .pub #42

Open
miguelgfierro opened this issue May 2, 2018 · 0 comments

Comments

@miguelgfierro
Copy link
Owner

Based on this tutorial.

How to generate a Key Pair for authentication without password

ssh-keygen -t rsa -b 2048 -v

We have to add the keyname migonzagpup100_rsa:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/miguel/.ssh/id_rsa): /Users/miguel/.ssh/migonzagpup100_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/miguel/.ssh/migonzagpup100_rsa.
Your public key has been saved in /Users/miguel/.ssh/migonzagpup100_rsa.pub.
The key fingerprint is:
SHA256:2VVHKEfxyzrawPDUzrYvK/WbMLlvYK/6PzUBCKoWmW4 [email protected]
The key's randomart image is:

You get two files, migonzagpup100_rsa.pub and migonzagpup100_rsa.

Uploading the generated certificate from client computer to server

Then we need to copy the public key to the server

ssh-copy-id -i /Users/miguel/.ssh/migonzagpup100_rsa.pub [email protected]

Now we make sure that we can log in using the private key (without the password):

ssh -i /Users/miguel/.ssh/migonzagpup100_rsa [email protected]

Authenticating directly through hostname

You can create the file ~/.ssh/config and add the following lines:

Host migonzagpup100 migonzagpup100.westeurope.cloudapp.azure.com
Hostname migonzagpup100.westeurope.cloudapp.azure.com
User hoaphumanoid
IdentityFile /Users/miguel/.ssh/migonzagpup100_rsa

Host migonzagpup100london migonzagpup100london.westeurope.cloudapp.azure.com
Hostname migonzagpup100london.westeurope.cloudapp.azure.com
User hoaphumanoid
IdentityFile /Users/miguel/.ssh/migonzagpup100london

Now you can ssh to the machine directly by using the hostname: ssh migonzagpup100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant