首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何启用不带公钥/私钥的ssh访问?

如何启用不带公钥/私钥的ssh访问?
EN

Server Fault用户
提问于 2018-07-06 20:41:41
回答 2查看 16.4K关注 0票数 8

我正在为我的俱乐部成员建立一个渐进的网络挑战(挑战起作用),但我想要做的是让每个挑战都显示下一个账户的密码(有点像overthewire.org上的强盗挑战)。

因此,我在盒子上创建了18个帐户,每个帐户都有不同的密码,user7的密码隐藏在user6的主目录中,您必须通过挑战才能得到它。

无论如何,一切都在本地工作,但我似乎不能为这些非根帐户启用只密码ssh。要让公共密钥ssh正常工作,有很多问题,但是一切似乎都像密码ssh自动工作一样,但它总是告诉我,我的密码是无效的,即使它不是。有人知道这方面的一个好指南吗?

Ubuntu 18.04

/etc/ssh/sshd_config

代码语言:javascript
复制
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
EN

回答 2

Server Fault用户

发布于 2018-07-06 20:50:23

你需要添加

代码语言:javascript
复制
PasswordAuthentication yes

中的配置文件。

代码语言:javascript
复制
/etc/ssh/sshd_config

一旦添加了这个命令,您将需要重新加载SSH守护进程,使用sudo systemctl restart ssh或类似的方法,以适合您的平台。

票数 9
EN

Server Fault用户

发布于 2018-08-14 12:16:33

您可能缺少AuthenticationMethods设置。

此外,我还建议使用匹配指令将这些设置限制在特定的用户帐户上。

此配置片段启用特定用户foobar的密码身份验证,而其余配置代码则使用公开密钥身份验证:

代码语言:javascript
复制
Match User foobar
    PasswordAuthentication yes
    AuthenticationMethods password
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/919853

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档