How To Setup SSH Keys

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-setup-ssh-keys/
PINTEREST
PINTEREST
INSTAGRAM

Ssh is a protocol designed to make network connections between hosts secure. Ssh is de facto standard for Linux and related operating system. Ssh encrypts the connection between sides. Ssh gives terminal access between host and server.

To get a terminal there need to be an authentication process. The authentication process is generally password based but there are some caveats for password based authentication. Brute force attacks can guess the password and gives access to the server.

To make things more secure key based authentication can be used. It is far more secure and practical to used in logins or batch operations.

Creating Key Pairs

We will create key pairs. We may ask yourself why pair. Isn’t 1 key enough. In Asymmetric cryptography key pairs where each if different is used to complete each other. One key is named public which is known by public. One key is named private and only known by owner.

We have created a key pair based RSA algorithm. Our key pairs are 2048 bit. So is more secure as long as more longer key size. We can protect our key pair with passphrase but it is not practical for most situations. Our key pair is located by default users home directories .ssh file.

LEARN MORE  How To Check Integrity Of Files?

Keep in mind that while working with ssh configuration we need root privileges. Best way to get root privileges use following command.

Adding Key to Remote Server

Now we have a key to use. We will add this key to a remote server for a user.

We use ssh-copy-id command to add our key for the root user in the remote server whose ip address is 192.168.122.137 . After adding our key we can login remote server without entering passphrase/password like this.

LEARN MORE  How To Add New User With Home Directory To Linux

Disable Password Based Authentication for SSH Configuration

After completing these steps we can disable password based authentication for ssh server.

Open sshd_config file and change PasswordAuthentication and PermitRootLogin line like below

Apply SSH Server Configuration

Then restart SSH server to load with new configuration.

Have a secure day 🙂

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-setup-ssh-keys/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

1 Response

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)