Set SSH automatic login (password-free, user name)

Source: Internet
Author: User
Set SSH automatic login (password-free, user name) 1. create a public key and public key ssh-keygen-trsa. just press enter to the end. 2. copy the public key id_rsa.pub to/home/username/on the remote machine /. name the ssh directory and name it authori... set SSH automatic login (password-free, user name) 1. create a public key and public key ssh-keygen-t rsa. ignore any prompts and press enter to the end. 2. copy the public key id_rsa.pub to the/home/username/. ssh Directory of the remote machine and name it authorized_keys. Method 1: One step in place: scp ~ /. Ssh/id_rsa.pub username @ hostname :~ /. Ssh/authorized_keys Method 2: copy scp ~ /. Ssh/id_rsa.pub username @ hostname :~ Log on to ssh username @ hostname and append cat id_rsa.pub>. ssh/authorized_keys by using various methods. if you are happy, copy it ~ Multiple remote hosts can be copied multiple times ~ If your local login user is the same as the remote login user, you can directly log on to the ssh hostname directly. 3. Solve the inconsistency between the local login user and the remote login user. well, this is very difficult. although you don't need to enter the password, you have to log in by using ssh username @ hostname, which is quite uncomfortable, you know. In fact, the solution is also very simple (but my colleague told me that the old face is red), modify the local login user ~ /. In the ssh/config file, if there is a wood, create one by yourself. the content is as follows: Host hostname user username Host hostname2 user username2, you can also log on to the local host by using ssh hostname, which is inconsistent with the remote login username. Close.
 
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.