Linux System Setup key login, disable root account password login

Source: Internet
Author: User

One: Generate key

  1. Shell Point tool New user key generation

  2. You can see the key generation interface, choose the RSA encryption algorithm, the key length is set to 2048 here.

  3. The key has been generated, select Next, Next.

  4. Enter the key name, and the password to encrypt the key, and proceed to the next step.

  5. Now you can see the public key information and save the public key copy.

  6. Create a hidden directory in the root user home directory. SSH, and create a Authorized_key file in this directory, and put the pre-generated public key into Authorized_key.

Mkdir-v ~/.ssh

Vim ~/.ssh/authorized_keys  

Modify Permissions

chmod ~/.ssh/authorized_keys

chmod. ssh/

7. Clear firewall rules and turn off SELinux

Iptables-f

Setenforce 0

8 Modify the SSH configuration file and remove the comment to enable it to support key authentication. Vim/etc/ssh/sshd_config

Rsaauthentication Yes

Pubkeyauthentication Yes

Restarting the sshd service

/etc/init.d/sshd restart

9. New session fill in the name with the host, OK login

Linux System Setup key login, disable root account password login

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.