Linux add SSH Public key access

Source: Internet
Author: User

Login to the managed server, enter the user directory that requires remote login, put the public key into the user directory. SSH directory (if the directory does not exist, you need to create the ~/.SSH directory, and set the directory permissions to 700), the public key renamed to Authorized_keys,  and set its user rights to 600.

  1. [[Email protected] ~]$ mkdir ~/.ssh #如果当前用户目录下没有. SSH directory, please create the directory first
  2. [Email protected] ~]$ chmod ~/.ssh
  3. [Email protected] ~]$ CD ~/.ssh
  4. [[Email protected] ~]$ Touch Authorized_keys #如果不存在这个文件, create this file.
  5. [Email protected] ~]$ chmod authorized_keys
  6. #把你生成的公钥复制到authorized_keys文件中, make sure the copy is correct, or "server refused our key" will appear.
  7. [Email protected] ~]$ ls-l
  8. Total 4
  9. -RW------1 root root 393 June 11:25 Authorized_keys

This allows you to log on remotely using putty. When I copied publickey to Authorized_keys file, there was an inexplicable lack of a ' s ' in the file header. As a result, "server refused our key" appears. Then I took the problem to search, Baidu on the solution of a variety of ways. I still more believe that my operation is not wrong, so I went to check the Authorized_keys file.

Touch command

Explanation: http://www.cnblogs.com/peida/archive/2012/10/30/2745714.html

This is used to create a file that does not exist.

Linux add SSH Public key access

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.