diff -up kbd-1.15.5/src/vlock/auth.c.orig kbd-1.15.5/src/vlock/auth.c
--- kbd-1.15.5/src/vlock/auth.c.orig 2017-08-28 15:05:02.499936226 +0200
+++ kbd-1.15.5/src/vlock/auth.c 2017-09-05 14:56:00.856307724 +0200
@@ -160,6 +160,15 @@ get_password (pam_handle_t * pamh, const
break;
default:
+ if (!isatty(STDIN_FILENO))
+ {
+ /* Cancel locking. */
+ pam_end (pamh, rc);
+ syslog (LOG_NOTICE,
+ "Cancelled lock of %s on %s for %s by (uid=%u)",
+ locked_name (), tty, username, uid);
+ return EXIT_FAILURE;
+ }
printf ("%s.\n\n\n", pam_strerror (pamh, rc));
fflush (stdout);
}