From b34bc0e6f97ca55b7d6c85b710f9bc40783c41e9 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 7 Apr 2015 15:44:44 +0200 Subject: [pam] fix annoying errors when logging out of ttys loginctl only show graphically logged in users, not on ttys, therefore loginctl will fail when logging out of a tty and dump errors on stderr. Soon everything will be different but still cosmetics :) --- remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close index 4fc2ce6a..9332e0a6 100755 --- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close +++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close @@ -26,7 +26,7 @@ if [ -d "/opt/openslx/scripts/pam_script_ses_close.d" ]; then done fi -OPENSESSION=$(loginctl show-user "$PAM_USER" | grep "Sessions=" | cut -c 10-) +OPENSESSION=$(loginctl show-user "$PAM_USER" 2>/dev/null| grep "Sessions=" | cut -c 10-) SESSIONCOUNT=$(echo "$OPENSESSION" | wc -w) # When using su/sudo there is no session created, so count up by one if [ "x$PAM_SERVICE" = "xsu" -o "x$PAM_SERVICE" = "xsudo" ]; then @@ -55,7 +55,7 @@ if [ "$SESSIONCOUNT" -le "1" ]; then done # just to be sure we check if there's no other open session in the meantime - OPEN2=$(loginctl show-user "$PAM_USER" | grep "Sessions=" | cut -c 10-) + OPEN2=$(loginctl show-user "$PAM_USER" 2>/dev/null | grep "Sessions=" | cut -c 10-) if [ -z "$OPEN2" -o "x$OPENSESSION" = "x$OPEN2" ]; then -- cgit v1.2.3-55-g7522