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

+11 -6
View File
@@ -313,10 +313,11 @@ CREATE_SYMLINK_WEB_BASE_DIR=false
# - with chrooted SFTP access:
# - sshd has to restrict members of that group to (chrooted) sftp
# -
# - If this group does not exist, group 'sftpusers' is used (if exists).
# - If neither exists, the suEXEC user is not added to any SFTP group.
# - If a different group is configured (create_vhost.conf) and that 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"
@@ -591,6 +592,10 @@ fi
# - ('sftpusers'), if it exists. If neither exists, no SFTP group is used.
# -
_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 [[ -n "$SFTP_CHROOT_GROUP" ]] && getent group "$SFTP_CHROOT_GROUP" > /dev/null ; then
_sftp_group="$SFTP_CHROOT_GROUP"
@@ -2107,7 +2112,7 @@ if $_print_summary ; then
if [[ -n "$_sftp_group" ]]; then
echo " SFTP chroot group (sshd).......: $_sftp_group"
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
@@ -2491,9 +2496,9 @@ if $_suEXEC ; then
fi
fi
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
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
# - Webserver user must be able to read all files of the SFTP user