加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 同时使用密钥对和密码的SSH

发布时间:2020-12-13 16:49:52 所属栏目:Linux 来源:网络整理
导读:是否可以启用ssh同时使用密钥对和密码,因此客户端需要密钥文件并且还知道密码? 为了只有一个不起作用. 我不使用半径或任何东西进行两步验证.只是想提高一点安全性. 谢谢 解决方法 从 https://security.stackexchange.com/questions/17931/possible-to-use-b
是否可以启用ssh同时使用密钥对和密码,因此客户端需要密钥文件并且还知道密码?
为了只有一个不起作用.

我不使用半径或任何东西进行两步验证.只是想提高一点安全性.

谢谢

解决方法

从 https://security.stackexchange.com/questions/17931/possible-to-use-both-private-key-and-password-authentication-for-ssh-login起

Now on RHEL / CentOS 7,and any system with a recent version of
OpenSSH,you can use:

AuthenticationMethods "publickey,password" "publickey,keyboard-interactive"

另见:https://lwn.net/Articles/544640/

It is also important to note that the AuthenticationMethods feature applies only to the SSH 2 protocol,and that each authentication method listed must also be explicitly enabled in the sshd_config file.

这里有一个很好的解释:

https://sysconfig.org.uk/two-factor-authentication-with-ssh.html

Match User johndoe
AuthenticationMethods publickey,keyboard-interactive

Read the commas as logical AND. On login,johndoe’s key pair will be checked first and if it’s a match,you’ll see this:

Authenticated with partial success.

Then,he will be asked for his password. So without realising,you have just set up MFA. Your key pair being what you have,the account password being what you know. This is possibly the simplest way of setting up MFA with SSH,and already better than single-factor authentication.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读