From 86a25141cdf635e1386d9fbfd3b15febfec778bc Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 12 Mar 2008 19:54:14 +0100 Subject: [PATCH 1/1] Also require $SSH_CONNECTION to be unset or warn This takes care of some more cases, such as #469951, in which screen was used, which creates a new pty which is thus no longer owned by sshd. Signed-off-by: martin f. krafft --- shutdown | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 -- 2.39.5