CentOS remote login using Putty key authentication

Source: Internet
Author: User
1. to disable SELinux for SSH, run the following command: # setenforce0 # temporarily disable SELinux. after restart, the system will enable # vi/etc/selinux/config to modify the configuration file so that SELINUX = disabled2 can disable firewall rules # I

1. to disable SELinux for ssh, run the following command:

# Setenforce 0 # temporarily disable SELinux, which will be enabled after restart

# Vi/etc/selinux/config modify the configuration file to make SELINUX = disabled

2. disable firewall rules

# Iptables-F # clear firewall rules

# Service iptables save # save rules

 

3. use puttygen.exe to generate a key pair

1) open the software and click Generate to Generate the public key. when the public key is generated, the cursor moves back in the progress bar to Generate the public key quickly.

2) after the public Key is generated, enter the logon name in the Key comment column.

3) If password verification is required, enter the password in the Key passphrase column.

4) copy the public key above to the host's ~ /. Ssh/authorized_keys file. If no file exists, create it by yourself.

5) click Save private key to Save the private key to a safe place.

 

4. log on with Putty

1) open the SSH entry on the left side of Putty, click Auth, and use Browse to import the saved private key file.

2) click Session on the left and enter the Host name or IP address in Host Nmae,

3) enter the Session name in the Saved Session column and click save to facilitate next login.

4) select the saved Session and click Open logon host.

5) enter the user name and ssh password to connect to the host.

 

Appendix: 1 Command to check whether the sshd service is enabled

# Netstat-anpt | grep 'sshd' # if output exists, it indicates that the instance has been started.

2. view the status of SELinux

# Getenforce # Disable output Disabled

3. configure ssh

# Vi/etc/ssh/sshd_config # configure the ssh version, number of keys, and port number.

4. ssh key generation command

# Ssh-t rsa-f/etc/ssh/ssh_host_rsa_key # generate an RSA key pair

# Cat/etc/ssh/ssh_host_rsa_key.pub> ~ /. Ssh/authorized_keys # export the public key

5. if SELinux and iptables are correctly configured and the server refused our key appears during logon, check whether the public key is correctly imported. for example, the front ssh-rsa is not copied or the copy is incomplete.

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.