Skip to content

Commit 52f45b2

Browse files
committed
Fix 'OpenSSH restart failed' email error after rebooting
1 parent 681bfdb commit 52f45b2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

bin/v-add-sys-sftp-jail

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ if [ -z "$sftp_i" ]; then
4646
echo " X11Forwarding no" >> $config
4747
echo " AllowTCPForwarding no" >> $config
4848
echo " ForceCommand internal-sftp" >> $config
49+
restart='yes'
4950
fi
5051

5152
# Validating opensshd config
52-
if [ "$restart" = 'no' ]; then
53-
# Skipping SSH Restart
54-
echo "" > /dev/null 2>&1
55-
else
53+
if [ "$restart" = 'yes' ]; then
5654
subj="OpenSSH restart failed"
5755
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
5856
/usr/sbin/sshd -t >/dev/null 2>&1
@@ -68,12 +66,12 @@ fi
6866
# Checking users
6967
shells="rssh|nologin"
7068
for user in $(grep "$HOMEDIR" /etc/passwd |egrep "$shells" |cut -f 1 -d:); do
71-
$BIN/v-add-user-sftp-jail $user
69+
$BIN/v-add-user-sftp-jail $user $restart
7270
done
7371

7472
# Add v-add-sys-sftp-jail to startup
7573
if [ ! -e "/etc/cron.d/hestia-sftp" ]; then
76-
echo "@reboot root /usr/local/hestia/bin/v-add-sys-sftp-jail" > /etc/cron.d/hestia-sftp
74+
echo "@reboot root sleep 60 && /usr/local/hestia/bin/v-add-sys-sftp-jail" > /etc/cron.d/hestia-sftp
7775
fi
7876

7977
#----------------------------------------------------------#

0 commit comments

Comments
 (0)