Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

/etc/issue.net not displaying system information for SSH logins

Writer 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) \t

Here 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?

1

2 Answers

It depends on the getty-type program employed on the system:

man issue

The 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 agetty

ISSUE 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.

...

n Insert the nodename of the machine, also known as the hostname. Same as uname -n.
O Insert the DNS domainname of the machine.
s Insert the system name (the name of the operating system). Same as uname -s. See also the \S escape code.
m Insert the architecture identifier of the machine. Same as uname -m.
r Insert the release number of the OS. Same as uname -r.
t Insert the current time.

1

Telnet

/etc/issue.net is (was) used as an “identification file for telnet sessions”. From the telnetd manual page:

If the file /etc/issue.net is present, telnetd will 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.net is 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.net

However, 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:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy