Просмотр исходного кода

Fix sftp homedir staring in /home and not /home/[user] (#4862)

Robert-Jan de Dreu 1 год назад
Родитель
Сommit
5c04a83d4d
2 измененных файлов с 4 добавлено и 1 удалено
  1. 1 1
      bin/v-add-sys-sftp-jail
  2. 3 0
      install/upgrade/versions/1.9.3.sh

+ 1 - 1
bin/v-add-sys-sftp-jail

@@ -51,7 +51,7 @@ if [ -z "$sftp_i" ]; then
 	echo "    ChrootDirectory /srv/jail/%u" >> $config
 	echo "    X11Forwarding no" >> $config
 	echo "    AllowTCPForwarding no" >> $config
-	echo "    ForceCommand internal-sftp -d /home" >> $config
+	echo "    ForceCommand internal-sftp -d /home/%u" >> $config
 	restart='yes'
 fi
 

+ 3 - 0
install/upgrade/versions/1.9.3.sh

@@ -33,6 +33,9 @@ if [ -x /usr/sbin/jailbash ]; then
 	$HESTIA/bin/v-add-sys-ssh-jail
 fi
 
+# Fix sftp not starting in /home/[user]
+sed -i -E "s/ForceCommand internal-sftp -d \/home$/ForceCommand internal-sftp -d \/home\/%u/g" /etc/ssh/sshd_config
+
 # Check if file exists
 if [ -f "/etc/cron.d/hestiaweb" ]; then
 	# Just remove it