diff --git a/man/nologin.8.xml b/man/nologin.8.xml
index ae355d3a..30d4f1b9 100644
--- a/man/nologin.8.xml
+++ b/man/nologin.8.xml
@@ -72,6 +72,9 @@
nologin5
.
+
+ If SSH_ORIGINAL_COMMAND is populated it will be logged.
+
diff --git a/src/nologin.c b/src/nologin.c
index 98989d26..b137f9cd 100644
--- a/src/nologin.c
+++ b/src/nologin.c
@@ -45,9 +45,14 @@ int main (void)
if (NULL == user) {
user = "UNKNOWN";
}
+
+ char *ssh_origcmd = getenv("SSH_ORIGINAL_COMMAND");
uid = getuid (); /* getuid() is always successful */
openlog ("nologin", LOG_CONS, LOG_AUTH);
- syslog (LOG_CRIT, "Attempted login by %s (UID: %d) on %s", user, uid, tty);
+ syslog (LOG_CRIT, "Attempted login by %s (UID: %d) on %s%s%s",
+ user, uid, tty,
+ (ssh_origcmd ? " SSH_ORIGINAL_COMMAND=" : ""),
+ (ssh_origcmd ? ssh_origcmd : ""));
closelog ();
printf ("%s", "This account is currently not available.\n");