@@ -27,7 +27,7 @@ source $HESTIA/conf/hestia.conf
2727# Checking sshd directives
2828config=' /etc/ssh/sshd_config'
2929sftp_n=$( grep -n " Subsystem.*sftp" $config | grep -v internal | grep -v " :#" )
30- sftp_i=$( grep -n " Subsystem.*sftp " $config | grep internal | grep -v " :# " )
30+ sftp_i=$( grep -n " ^# Hestia SFTP Chroot " $config )
3131
3232# Disabling normal sftp
3333if [ ! -z " $sftp_n " ]; then
3939# Enabling jailed sftp
4040if [ -z " $sftp_i " ]; then
4141 echo " " >> $config
42- echo " Subsystem sftp internal-sftp" >> $config
43- echo " Match Group sftp-only" >> $config
44- echo " ChrootDirectory /chroot/%u" >> $config
45- echo " AllowTCPForwarding no" >> $config
42+ echo " # Hestia SFTP Chroot" >> $config
43+ echo " Match User sftp_dummy99" >> $config
44+ echo " ChrootDirectory %h" >> $config
4645 echo " X11Forwarding no" >> $config
46+ echo " AllowTCPForwarding no" >> $config
4747 echo " ForceCommand internal-sftp" >> $config
4848 restart=' yes'
4949fi
@@ -63,32 +63,12 @@ if [ "$restart" = 'yes' ]; then
6363 fi
6464fi
6565
66- # Adding sftp group
67- groupadd sftp-only 2> /dev/null
68-
6966# Checking users
7067shells=" rssh|nologin"
7168for user in $( grep " $HOMEDIR " /etc/passwd | egrep " $shells " | cut -f 1 -d:) ; do
7269 $BIN /v-add-user-sftp-jail $user
7370done
7471
75- # Adding v-add-sys-sftp-jail to startup
76- if [ -e " /etc/rc.local" ]; then
77- check_sftp=$( grep $0 /etc/rc.local)
78- check_exit=$( grep ^exit /etc/rc.local)
79- if [ -z " $check_sftp " ]; then
80- if [ -z " $check_exit " ]; then
81- echo " $BIN /v-add-sys-sftp-jail" >> /etc/rc.local
82- else
83- sed -i " s|^exit|$BIN /v-add-sys-sftp-jail\nexit|" /etc/rc.local
84- fi
85- fi
86- chmod +x /etc/rc.local
87- else
88- echo " $BIN /v-add-sys-sftp-jail" > /etc/rc.local
89- chmod +x /etc/rc.local
90- fi
91-
9272# ----------------------------------------------------------#
9373# Hestia #
9474# ----------------------------------------------------------#
0 commit comments