SFTP Login with key

Source: Internet
Author: User
Tags openssh server

1. Generate 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

Input ssh-keygen-t RSA represents the generation of RSA passwords that can be stored in a location, if you do not enter a location, use the default value, under the home under the name of the user. SSH, the middle appears to require a password, you can enter, or do not enter, if you want to remember the password

This generates two files Id_rsa and id_rsa.pub under/home/username/.ssh/, where Id_rsa is the private key, the id_rsa.pub is the public key, the private key is used by the client, and the public key is id_rsa.pub as Authorized_ Keys

2, modify the OpenSSH server-side configuration

Locate the file Sshd_config in the ETC directory at the installation location, such as my file location in/etc/sshd_config, modify the following two items

Authorizedkeysfile. Ssh/authorized_keys

Passwordauthentication No

The first parameter is used to describe the location of the public key file, the second is to force key access, not the username and password, and of course the second parameter can remain yes, which can be accessed in two ways.

3, restart Openss

net stop opensshd

net start opensshd

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.