The FreeBSD Diary
Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link.
changing the pre-login text - also known as /etc/issue 6 January 1999
Pre-login text appears at the start of your telnet session. It looks something
FreeBSD (ns.freebsd.nz.eu.org) (ttyp2) login:
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.
|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:
default:\ :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:
default:\ #: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
default:\ :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:
|This tip from Philip Hallstrom <firstname.lastname@example.org>.
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.