X-Git-Url: https://git.madduck.net/code/molly-guard.git/blobdiff_plain/048c6a97f910e0dc1401015065cf56ff9bc86e19..86a25141cdf635e1386d9fbfd3b15febfec778bc:/shutdown diff --git a/shutdown b/shutdown index 2489827..29bd8fe 100755 --- a/shutdown +++ b/shutdown @@ -90,12 +90,13 @@ test -t 0 || do_real_cmd # only run if we are being called over SSH, that is if the current terminal # was created by sshd. PTS=$(readlink /proc/$$/fd/0) -if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null; then - if [ $PRETEND_SSH -eq 1 ]; then - echo "I: this is not an SSH session, but --pretend-ssh was given..." - else - do_real_cmd - fi +if ! pgrep -f "^sshd.+${PTS#/dev/}[[:space:]]*$" >/dev/null \ + && [ -z "$SSH_CONNECTION" ]; then + if [ $PRETEND_SSH -eq 1 ]; then + echo "I: this is not an SSH session, but --pretend-ssh was given..." + else + do_real_cmd + fi else echo "W: $ME: SSH session detected!" fi