Skip to content

Commit cf655a3

Browse files
authored
Merge pull request #794 from mib1185/allow-seperate-password-login-for-sftp
Allow to override settings for sftponly users
2 parents e318aab + 4ae5acf commit cf655a3

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

roles/ssh_hardening/templates/opensshd.conf.j2

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,6 @@ RevokedKeys /etc/ssh/revoked_keys
274274
# Subsystem sftp /opt/app/openssh5/libexec/sftp-server
275275

276276
Subsystem sftp internal-sftp -l INFO -f LOCAL6 -u {{ sftp_umask }}
277-
278-
# These lines must appear at the *end* of sshd_config
279-
Match Group sftponly
280-
ForceCommand internal-sftp -l INFO -f LOCAL6 -u {{ sftp_umask }}
281-
{% if sftp_chroot %}
282-
ChrootDirectory {{ sftp_chroot_dir }}
283-
{% endif %}
284-
AllowTcpForwarding no
285-
AllowAgentForwarding no
286-
PasswordAuthentication {{ 'yes' if (ssh_server_password_login|bool) else 'no' }}
287-
PermitRootLogin no
288-
X11Forwarding no
289277
{% endif %}
290278
{% if ssh_server_match_address %}
291279

@@ -335,3 +323,17 @@ Match LocalPort {{ item.port }}
335323
{% endfor %}
336324
{% endfor %}
337325
{% endif %}
326+
327+
{% if sftp_enabled %}
328+
# These lines must appear at the *end* of sshd_config
329+
Match Group sftponly
330+
ForceCommand internal-sftp -l INFO -f LOCAL6 -u {{ sftp_umask }}
331+
{% if sftp_chroot %}
332+
ChrootDirectory {{ sftp_chroot_dir }}
333+
{% endif %}
334+
AllowTcpForwarding no
335+
AllowAgentForwarding no
336+
PasswordAuthentication {{ 'yes' if (ssh_server_password_login|bool) else 'no' }}
337+
PermitRootLogin no
338+
X11Forwarding no
339+
{% endif %}

0 commit comments

Comments
 (0)