D
Deleted member 66267
Guest
I need to enable password authorization. Just don't know if it should be edited directly or if shouldn't where to put the config other than the file. Thanks.
I would avoid editing it. If you change it, it needs to be merged upon updates. This is not a problem per-se, but it’s something you need to be aware of, and it might cause problems if you’re not careful.Yes, this file is ment to be edited directly. Keep in mind you have to restart sshd to take effect.
sshd_flags
line to the /etc/rc.conf file (which never requires merging because it contains just the overrides for /etc/defaults/rc.conf).When you doIf you want to change just one or two settings, it’s probably best to put a line like
sshd_flags="-o key1=value1 -o key2=value2"
in /etc/rc.conf. Command line flags override the settings in the configuration file.
sysrc sshd_flags+=" -o keyN=valueN"
you may also want to add a comment in your sshd_config(5) to always check sysrc sshd_flags
. Else it's easy to forget about extra command line flags & wonder why some settings refuse to apply Password authentication is enabled by default? WhileI want to enable password authorization. The default is no.
PasswordAuthentication
is indeed set to no
, UsePAM
is enabled. Which means you can use passwords or public/private keys to login. UsePAM Enables the Pluggable Authentication Module interface. If set to
yes this will enable PAM authentication using
ChallengeResponseAuthentication and PasswordAuthentication in
addition to PAM account and session module processing for all
authentication types.
Because PAM challenge-response authentication usually serves an
equivalent role to password authentication, you should disable
either PasswordAuthentication or ChallengeResponseAuthentication.
If UsePAM is enabled, you will not be able to run sshd(8) as a
non-root user. The default is yes.
You meanI want to enable password authorization. The default is no. Which sshd_flags I should set? This is what I want to know.
PasswordAuthentication
, right? (Note that authorization and authentication are different things.)PasswordAuthentication
flag should be kept at the default (i.e. off).sshd_flags="-o PasswordAuthentication=yes"
PasswordAuthentication
to be able to login with password. Some Linux distros default to key file only and don't accept any kind of password, so I have to turn on PasswordAuthentication
as some online tutorial sites told me. This knowledge I bring from Linux can't apply to FreeBSD. I was wrong.sshd_flags="-o PasswordAuthentication=yes"
mkdir -p /usr/local/etc/ssh/sshd_config.d/
cat << EOF >/usr/local/etc/ssh/sshd_config
Include /etc/ssh/sshd_config
Include /usr/local/etc/ssh/sshd_config.d/*.conf
EOF
sysrc sshd_flags="-f /usr/local/etc/ssh/sshd_config"
service sshd restart
If you want to change just one or two settings, it’s probably best to put a line like
sshd_flags="-o key1=value1 -o key2=value2"
in /etc/rc.conf. Command line flags override the settings in the configuration file.
I would avoid editing it. If you change it, it needs to be merged upon updates.
PasswordAuthentication
is not needed as UsePAM
is enabled by default.That's actually what I do since I read these comments(#15 and #17) in this thread, and it seems to work for me:Does base SSH support the concept of "include config files from this subdirectory"? I know that happens on Linux systems, not sure if it was a "linux-ism" or something that could be taken advantage of here.
/etc/ssh/sshd_config.custom
(or better in something like /usr/local/etc/sshd?) with an include directive like so:Include sshd_config
# Custom stuff below...
sshd_flags="-f /etc/ssh/sshd_config.customized"
I don't disagree with this, but given one must already be root to write to /etc/ssh (at least for stock configuration) I think this would be an understandable configuration.Always keep in mind that ingesting configuration from multiple locations (especially locations writeable by any user) also increases the attack surface. For a high-profile service like sshd this is definitely not desirable, so the default configuration should be kept as basic and (reasonably) secure as possible.
That's right /etc/ssh/sshd_config.d would be fine indeed.gotnull that's a good solution; now if only the config in base had that include directive already, then we only argue about the correctness of putting things in /etc/ssh/sshd_config.d But I look at that being similar to /etc/defaults/rc.conf and /etc/rc.conf
include sudoers.d