Skip to content

Commit

Permalink
Gracefully shut down sshd
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Dec 29, 2023
1 parent cea555f commit ef3b186
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 40-setup-users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,8 @@ fi
# Generate SSH host keys and start the SSH daemon
ssh-keygen -A
/usr/sbin/sshd -e -D &
SSHD_PID=$!
echo "sshd started with PID $SSHD_PID"
# Trap both SIGQUIT and SIGTERM and forward as SIGQUIT to sshd
trap 'echo "Received SIGQUIT, forwarding to sshd (PID $SSHD_PID)"; kill -s SIGQUIT $SSHD_PID' SIGQUIT
trap 'echo "Received SIGTERM, forwarding to sshd (PID $SSHD_PID)"; kill -s SIGQUIT $SSHD_PID' SIGTERM

0 comments on commit ef3b186

Please sign in to comment.