Jan 061999

changing the pre-login text – also known as /etc/issue

Pre-login text appears at the start of your telnet session.  It looks something like this:
FreeBSD (ns.freebsd.nz.eu.org) (ttyp2)


You can then enter your user id and password.  Please don’t confuse this with the post-login text, otherwise known as the Message Of The Day (motd).

You will notice that the message contains information about the operating system and the terminal.  It is considered by some that such information should not be given out.   If someone is scanning IP addresses for a telnet prompt, if they know the type of system they’ve found, then they’re that much further ahead.  I’ve recently changed my system so that this information is not given out.

This topic started when Rzzo (Baris D. Bal) on #freebsd undernet said he was looking to change the pre-login text. I searched the mailing list archives and found the information and passed it to him.  He got it to work but I couldn’t.  Eventually, we figured out what was wrong.

There are two ways to do this.  You can either change the banner or you can disable the banner.

Change the banner

The pre-login text, or banner, is specified in /etc/gettytab.  I found the setup confusing at first, but with the mistakes I made, you should find it easy to change the message.  Look for something like the following:
  :cb:ce:ck:lc:fd#1000:im=\r\n\r\nFreeBSD (%h) (%t)\r\n\r\n:sp#1200:

Being a cautious person, I saved the original line in case I screwed up.  Here’s what I put for my first attempt:

#:cb:ce:ck:lc:fd#1000:im=\r\n\r\nFreeBSD (%h) (%t)\r\n\r\n:sp#1200: 
 :cb:ce:ck:lc:fd#1000:im=\r\n\Hello.  Welcome to the box.\r\n\r\n:sp#1200:

Then I tried to reconnect.  No change in the prompt.  I looked at lots of things,  I couldn’t get it to work.  After several false starts, it clicked.   You can’t have a # after the default.  See the next section for what you should have:


Here’s what you need to put in.  I kept the comment line so I knew what the original code contained.  Note that %h = hostname and that %t is the terminal.  You can’t have a comment (i.e. #) right after the default line.
 :cb:ce:ck:lc:fd#1000:im=\r\n\Hello.  Welcome to the box.\r\n\r\n:sp#1200:
#:cb:ce:ck:lc:fd#1000:im=\r\n\r\nFreeBSD (%h) (%t)\r\n\r\n:sp#1200: 

Disable the banner

This tip from Philip Hallstrom <philip@adhesivemedia.com>.   Thanks Philip for pointing this out to me.

If you want to remove the pre-login text, just modify /etc/inetd.conf and add the -h option for telnetd.  Here’s what that line looks like on my 3.2-RELEASE test box:

telnet  stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd -h

And from man telnetd you find this:

     -h      Disable the printing of host-specific information before login
             has been completed.

Remember to HUP inetd to invoke these changes.

  2 Responses to “changing the pre-login text – also known as /etc/issue”

  1. the topic mentions /etc/issue, because that’s where the pre-login message is read from on many other unix systems… but the text doesn’t mention how to make freebsd get it from there.

    here’s how:

    just add an "if=/etc/issue" field to the default section of /etc/gettytab.

  2. How does one change the login behaviour on /dev/console to say "My/Ux login:" instead of "FreeBSD/i386 (pc.domain.com) (ttyv0).

    Wim Olivier