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-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.
 

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.