SSH key Creation

Source: Internet
Author: User
Tags openssh server

1. Generate a key

> Ssh-keygen-T RSA
Generating public/private RSA key pair.
Enter file in which to save the key (/home/username/. Ssh/id_rsa ):
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/home/username/. Ssh/id_rsa.
Your public key has been saved in/home/username/. Ssh/id_rsa.pub.
The key fingerprint is:
73: 37: D0: 8B: 0f: 9d: 31: 56: 84: 1D: Fe: 1E: BC: C1: 5D: F2 username @ mdt-9323e858fb8

Enter ssh-keygen-t rsa to generate the RSA password, which can be stored. If you do not enter the location, use the default value, which is under the current user name in the home. in SSH, a password is required in the middle. You can enter or not enter the password. If you enter the password, remember the password.

In this way, in/home/username /. two files, id_rsa and id_rsa.pub, are generated under ssh/. id_rsa is the private key, id_rsa.pub is the public key, and the private key is used by the client. The name of id_rsa.pub is authorized_keys.


2. Modify the OpenSSH server configuration

Find the sshd_config file in the etc directory of the installation location. For example, if my file is located in/etc/sshd_config, modify the following two items:

Authorizedkeysfile. Ssh/authorized_keys Key Authentication

Passwordauthentication No Password Authentication

The first parameter is used to describe the location of the public key file, and the second parameter is forced to use the key for access, instead of the user name and password. Of course, the second parameter can be set to yes, so there are two access methods.

3. Restart openss

Net stop opensshd

Net start opensshd

4. Restart sshd


Service sshd restart

This article from the "good memory as bad pen" blog, please be sure to keep this source http://10808387.blog.51cto.com/2925559/1565192

SSH key Creation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.