CentOS the configuration file for SSH without password login _linux

Source: Internet
Author: User
Tags chmod ssh centos

1, confirm the local sshd configuration file (requires root permissions)

$ gedit/etc/ssh/sshd_config

Find the following and remove the annotation "#"

Rsaauthentication Yes
pubkeyauthentication Yes
authorizedkeysfile. Ssh/authorized_keys

  2, if the configuration file changes need to restart the sshd service (requires root permissions)

$/sbin/service sshd Restart

Configuring SSH Password-free logon takes 3 steps:

1. Generate public and private keys

2. Import public key to authentication file, change permissions

3. Test

1. Generate public and private keys

Shell code: SSH-KEYGEN-T RSA

Two files are generated by default in the ~/.ssh directory:

Id_rsa: Private key
Id_rsa.pub: Public Key

2. Import public key to authentication file, change permissions

2.1 Import this machine

Shell code: Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

2.2 Importing servers for password-free logins

First copy the public key to the server

Shell code: SCP ~/.ssh/id_rsa.pub xxx@host:/home/id_rsa.pub

The public key is then imported into the authentication file (this step is done on the server)

Shell code: Cat/home/id_rsa.pub >> ~/.ssh/authorized_keys

2.3 Changing permissions on the server

Shell code: chmod ~/.ssh

chmod ~/.ssh/authorized_keys

3. Test SSH XXX

The above is a small set to introduce the CentOS SSH without password login configuration, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

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.