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.
- [[Email protected] ~]$ mkdir ~/.ssh #如果当前用户目录下没有. SSH directory, please create the directory first
- [Email protected] ~]$ chmod ~/.ssh
- [Email protected] ~]$ CD ~/.ssh
- [[Email protected] ~]$ Touch Authorized_keys #如果不存在这个文件, create this file.
- [Email protected] ~]$ chmod authorized_keys
- #把你生成的公钥复制到authorized_keys文件中, make sure the copy is correct, or "server refused our key" will appear.
- [Email protected] ~]$ ls-l
- Total 4
- -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