Linux disables root login and password login only supports SSH certificate login __linux

Source: Internet
Author: User
Tags file permissions
1. Generate a pair of key public key ssh-keygen-t RSA obtains two file Id_rsa (private key) id_rsa.pub (public key) private key to the client public key to deposit in/home/user/.ssh/authorized_keys so that the basis for verification is as much as Users who want to save multiple public key management headaches you can combine the generated multiple public keys into a single file, with each public key wrapped between them.
2. Modify the Linux Settings vim/etc/ssh/sshd_config key modification parameters are #禁用root账户登录, non-essential, but for security, please configure Permitrootlogin no # to let SSH     D to check the user's home directory or related file permissions data, # This is to worry about users of certain important file permissions set wrong, may cause some problems.     # For example, the user's ~.ssh/permissions are set incorrectly, and in some special cases, users are not allowed to log in Strictmodes No # allows the user to use the pair's key system for login behavior only for version 2. # As for the homemade public key data is placed in the user's home directory. Ssh/authorized_keys rsaauthentication Yes Pubkeyauthentication Yes Authorizedkeysfil E%h/.ssh/authorized_keys #有了证书登录了, disable password login bar, security is important passwordauthentication No
3. Restart SSH service      ubuntu  /etc/init.d/ssh restart      centos   service sshd Restar T    precautions, first confirm can be logged in by other accounts and then exit the system ...
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.