Use 'sftpusers' as default SFTP chroot group, drop 'sftp-chroot'

- create_vhost.sh: SFTP_CHROOT_GROUP defaults to 'sftpusers'. Fallback to
  'sftpusers' only if a different, non-existing group is configured.
  Messages list only the groups actually tried.
- create_vhost.conf.sample: example sshd Match block and default now
  use 'sftpusers'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrisandClaude Opus 5.5 committed 2026-11-16 17:29:02 +01:00
1 parent fec60403d1
commit 7a0e1efc3f
2 files changed
+15 -10

No files matched your search

+4 -4
View File
@@ -77,13 +77,13 @@
# - and "static site with suEXEC (chrooted SFTP access)"). # - and "static site with suEXEC (chrooted SFTP access)").
# - # -
# - The suEXEC user is added to this group, if it exists. Otherwise it is # - The suEXEC user is added to this group, if it exists. Otherwise it is
# - added to group 'sftpusers' (if exists). If neither group exists, the # - added to group 'sftpusers' (if exists). If no such group exists, the
# - user is not added to any SFTP group. (The group is not created.) # - user is not added to any SFTP group. (The group is not created.)
# - # -
# - sshd must restrict members of this group, i.e. at the end of # - sshd must restrict members of this group, i.e. at the end of
# - /etc/ssh/sshd_config: # - /etc/ssh/sshd_config:
# - # -
# - Match Group sftp-chroot # - Match Group sftpusers
# - ChrootDirectory %h # - ChrootDirectory %h
# - ForceCommand internal-sftp -u 0027 # - ForceCommand internal-sftp -u 0027
# - AllowTcpForwarding no # - AllowTcpForwarding no
@@ -92,6 +92,6 @@
# - PermitTunnel no # - PermitTunnel no
# - PermitTTY no # - PermitTTY no
# - # -
# - Defaults to 'sftp-chroot' # - Defaults to 'sftpusers'
# - # -
#SFTP_CHROOT_GROUP="" #SFTP_CHROOT_GROUP="sftpusers"
+11 -6
View File
@@ -313,10 +313,11 @@ CREATE_SYMLINK_WEB_BASE_DIR=false
# - with chrooted SFTP access: # - with chrooted SFTP access:
# - sshd has to restrict members of that group to (chrooted) sftp # - sshd has to restrict members of that group to (chrooted) sftp
# - # -
# - If this group does not exist, group 'sftpusers' is used (if exists). # - If a different group is configured (create_vhost.conf) and that group
# - If neither exists, the suEXEC user is not added to any SFTP group. # - does not exist, group 'sftpusers' is used (if exists). If no such group
# - exists, the suEXEC user is not added to any SFTP group.
# - # -
SFTP_CHROOT_GROUP="sftp-chroot" SFTP_CHROOT_GROUP="sftpusers"
SFTP_CHROOT_GROUP_FALLBACK="sftpusers" SFTP_CHROOT_GROUP_FALLBACK="sftpusers"
@@ -591,6 +592,10 @@ fi
# - ('sftpusers'), if it exists. If neither exists, no SFTP group is used. # - ('sftpusers'), if it exists. If neither exists, no SFTP group is used.
# - # -
_sftp_group="" _sftp_group=""
_sftp_groups_tried="\"$SFTP_CHROOT_GROUP\""
if [[ "$SFTP_CHROOT_GROUP_FALLBACK" != "$SFTP_CHROOT_GROUP" ]]; then
_sftp_groups_tried="${_sftp_groups_tried} / \"$SFTP_CHROOT_GROUP_FALLBACK\""
fi
if $_sftp_chroot ; then if $_sftp_chroot ; then
if [[ -n "$SFTP_CHROOT_GROUP" ]] && getent group "$SFTP_CHROOT_GROUP" > /dev/null ; then if [[ -n "$SFTP_CHROOT_GROUP" ]] && getent group "$SFTP_CHROOT_GROUP" > /dev/null ; then
_sftp_group="$SFTP_CHROOT_GROUP" _sftp_group="$SFTP_CHROOT_GROUP"
@@ -2107,7 +2112,7 @@ if $_print_summary ; then
if [[ -n "$_sftp_group" ]]; then if [[ -n "$_sftp_group" ]]; then
echo " SFTP chroot group (sshd).......: $_sftp_group" echo " SFTP chroot group (sshd).......: $_sftp_group"
else else
echo -e " SFTP chroot group (sshd).......: \033[33mnone\033[m (neither \"$SFTP_CHROOT_GROUP\" nor \"$SFTP_CHROOT_GROUP_FALLBACK\" exists)" echo -e " SFTP chroot group (sshd).......: \033[33mnone\033[m (group not found: ${_sftp_groups_tried})"
fi fi
fi fi
@@ -2491,9 +2496,9 @@ if $_suEXEC ; then
fi fi
fi fi
else else
echononl "\tAdd user \"$suEXEC_user\" to a SFTP group (\"$SFTP_CHROOT_GROUP\" / \"$SFTP_CHROOT_GROUP_FALLBACK\").." echononl "\tAdd user \"$suEXEC_user\" to a SFTP group (${_sftp_groups_tried}).."
echo_skipped echo_skipped
warn "Neither group \"$SFTP_CHROOT_GROUP\" nor group \"$SFTP_CHROOT_GROUP_FALLBACK\" exists.\n\t User \"$suEXEC_user\" was NOT added to a SFTP group." warn "SFTP group not found: ${_sftp_groups_tried}.\n\t User \"$suEXEC_user\" was NOT added to a SFTP group."
fi fi
# - Webserver user must be able to read all files of the SFTP user # - Webserver user must be able to read all files of the SFTP user