/etc/issue.net not displaying system information for SSH logins
Andrew Henderson
I would like to display some system information in /etc/issue.net. However, when I sudo pico /etc/issue.net and add the following, it just returns plain text when I login
user@box:~$ cat /etc/issue.net
This is \n.\O (\s \m \r) \tHere is what it outputs when logging in
user@box:~$ ssh localhost
This is \n.\O (\s \m \r) \t
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-62-generic i686)How do I remedy?
12 Answers
It depends on the getty-type program employed on the system:
man issueThe file /etc/issue is a text file which contains a message or system identification to be printed before the login prompt. It may contain various @char and \char sequences, if supported by the getty-type program employed on the system.
man agettyISSUE ESCAPES The issue-file (/etc/issue, or the file set with the -f option) may contain certain escape codes to display the system name, date, time etcetera. All escape codes consist of a backslash () immediately followed by one of the characters listed below.
...
1
nInsert the nodename of the machine, also known as the hostname. Same asuname -n.
OInsert the DNS domainname of the machine.
sInsert the system name (the name of the operating system). Same asuname -s. See also the \S escape code.
mInsert the architecture identifier of the machine. Same asuname -m.
rInsert the release number of the OS. Same asuname -r.
tInsert the current time.
Telnet
/etc/issue.net is (was) used as an “identification file for telnet sessions”. From the telnetd manual page:
If the file
/etc/issue.netis present,telnetdwill display its contents before the login prompt of a telnet session.
The contents of this file are described by the issue.net(5) manual page:
The file
/etc/issue.netis a text file which contains a message or system identification to be printed before the login prompt of a telnet session. It may contain various%-char(or, alternatively,\-char) sequences.
Note: its escape sequences are similar to – but not the same as – those supported by issue.net, e.g., \d and \t do the same thing: both print the time and date.
SSH
The OpenSSH server does not display the contents of issue or issue.net. However, it can be configured to send a pre-login banner (before the password prompt), similar to the Telnet server. The OpenSSH server Banner configuration option is described in the sshd_config(5) manual page as:
The contents of the specified file are sent to the remote user before authentication is allowed.
I’m guessing you included the following line in your SSH server configuration:
Banner /etc/issue.netHowever, sshd does not interpret any of the issue.net escape sequences and the SSH banner file should contain only “static” text (i.e., no special escape sequences).
Alternative solution
You can provide dynamic system information to users after they’ve logged in by using the update-motd package which modifies the message of the day. I haven’t done this myself but the following resources should help you: