ssh公钥验证的过程及遇到的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh公钥验证的过程及遇到的问题相关的知识,希望对你有一定的参考价值。

1.创建一对密钥;

2.将公钥复制并添加到~/.ssh/authorized_keys;

3.设定ssh客户端采用私钥进行登陆验证。

ssh公钥生效需满足的两个条件:
1) .ssh目录的权限必须是700 
2) .ssh/authorized_keys文件权限必须是600

ssh的man page:

FILES

~/.ssh/
This directory is the default location for all user-specific configuration and authentication information. There is no general requirement to keep the entire contents of this directory secret,but the recommended permissions are read/write/execute for the user, and not accessible by others.

~/.ssh/authorized_keys
Lists the public keys (RSA/ECDSA/DSA) that can be used for logging in as this user. The format of this file is described in the sshd(8) manual page. This file is not highly sensitive, but the recommended permissions are read/write for the user, and not accessible by others.

以上是关于ssh公钥验证的过程及遇到的问题的主要内容,如果未能解决你的问题,请参考以下文章

使用公钥身份验证为 Windows 设置 OpenSSH

openssl 证书 及ssh密匙

使用SSH过程中遇到的几个问题及解决方案

ssh免密登录及去掉提示

如何通过 SSH 在 azure devops 管道复制文件中使用公钥

Linux SSH 基于密钥交换的自动登录原理简介及配置说明