Skip to content

Commit 2b2f68c

Browse files
author
Kristan Kenney
committed
Enable SFTP subsystem in SSH configuration
1 parent 4cbc753 commit 2b2f68c

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

install/hst-install-debian.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,13 +891,20 @@ rm -f /usr/sbin/policy-rc.d
891891
# Enable SSH password authentication
892892
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
893893

894+
# Enable SFTP subsystem for SSH
895+
sftp_subsys_enabled=$(grep "#Subsystem sftp-server" /etc/ssh/sshd_config)
896+
if [ ! -z "$sftp_subsys_enabled" ]; then
897+
echo "(*) Updating SFTP subsystem configuration..."
898+
sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
899+
fi
900+
894901
# Disable SSH suffix broadcast
895902
if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
896903
echo '' >> /etc/ssh/sshd_config
897904
echo 'DebianBanner no' >> /etc/ssh/sshd_config
898-
service ssh restart
899905
fi
900906

907+
# Restart SSH daemon
901908
service ssh restart
902909

903910
# Disable AWStats cron

install/hst-install-ubuntu.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,13 +865,22 @@ rm -f /usr/sbin/policy-rc.d
865865
# Enable SSH password authentication
866866
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
867867

868+
# Enable SFTP subsystem for SSH
869+
sftp_subsys_enabled=$(grep "#Subsystem sftp-server" /etc/ssh/sshd_config)
870+
if [ ! -z "$sftp_subsys_enabled" ]; then
871+
echo "(*) Updating SFTP subsystem configuration..."
872+
sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
873+
fi
874+
868875
# Disable SSH suffix broadcast
869876
if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
870877
echo '' >> /etc/ssh/sshd_config
871878
echo 'DebianBanner no' >> /etc/ssh/sshd_config
872-
service ssh restart
873879
fi
874880

881+
# Restart SSH daemon
882+
service ssh restart
883+
875884
# Disable AWStats cron
876885
rm -f /etc/cron.d/awstats
877886

install/upgrade/0.10.0-190430.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ fi
344344
# Run sftp jail once
345345
$HESTIA/bin/v-add-sys-sftp-jail
346346

347+
# Enable SFTP subsystem for SSH
348+
sftp_subsys_enabled=$(cat /etc/ssh/sshd_config | grep "#Subsystem sftp-server")
349+
if [ ! -z "$sftp_subsys_enabled" ]; then
350+
echo "(*) Updating SFTP subsystem configuration..."
351+
sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
352+
service ssh restart
353+
fi
354+
347355
# Remove and migrate obsolete object keys
348356
for user in `ls /usr/local/hestia/data/users/`; do
349357
USER_DATA=$HESTIA/data/users/$user

0 commit comments

Comments
 (0)