• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer

GitopsCentral

  • Home
  • Courses
  • Roadmap
  • About
  • Log In
  • Sign Up

How to generate ssh keys and grant access to a remote server

May 31, 2019 by shaik zillani

i1.wp.com

In this blog post, I will show you how to generate ssh keys on local and grant access to your server.

Step-1: Create SSH keys on your local

First, you need to create ssh keys on your system by using ssh-keygen

ssh-keygen

This will ask you to enter passphrase for extra security, for now we can skip this by just hitting enter. After that it will create keys (one private key and one public key) in the directory, ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub with the following output as shown below.

id_rsa.pub is your public key which needs to be shared to your remote server

The key's randomart image is:
+---[RSA 2048]----+
| ..o+            |
|..o. .           |
|oo.   +          |
|+.   + .o  .     |
|o     ooSo. .    |
| .    oo.+o  .   |
|  o   o*..=.+.oo.|
| +    ..+o.+o*+o.|
|.E.    . .+oo+=o.|
+----[SHA256]-----+

Please note that even if you are on windows the procedure is same, but the keys are generated in different directory, you check this blog for more clarity.

Step-2: Upload Public key to remote server

Now as we have the public key generated from ssh-keygen, we need to upload the keys to the remote server inside the file, ~/.ssh/authorized_keys.

To do this, you can use the command below, make sure that update username and remote_host in the command below,

cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Finally, this will give you access to the remote server right away! and you can verify if you are able to login via ssh using command below,

ssh username@remote_host

Please also checkout our other blog posts on gitopscentral.com

ssh linux,  ssh

Primary Sidebar

en English
ar Arabiczh-CN Chinese (Simplified)nl Dutchen Englishfr Frenchde Germanhi Hindiid Indonesianit Italianja Japanesems Malaypt Portugueseru Russianes Spanishte Telugu

Course Tags

concurrency free go golang

Recent Posts

  • Roadmap to Mastery
  • Increase SSH connection timeout
  • Check Certificate expiry in Kubernetes
  • space invaders in golang
  • creating kubernetes cluster using eksctl
  • Facebook
  • GitHub
  • YouTube

Contact

Navigation

  • goacademy pro

Footer

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

info@gitopscentral.com


+91 8341443220

© Copyright 2016-2024 gitopscentral · All Rights Reserved ·