Operating System - HP-UX
1748228 Members
4377 Online
108759 Solutions
New Discussion юеВ

Re: How to: Display message before login prompt

 
John Ferro
Regular Advisor

How to: Display message before login prompt

Hi Gents,

How i could display a message before login prompt, so when any try to telnet so it appear with bold and large fons?

Regards,
J.F.
10 REPLIES 10
Javed Khan_1
Valued Contributor

Re: How to: Display message before login prompt

Hi,

Add -b banner file in /etc/inetd.conf

telnet stream tcp nowait root /usr/lbin/telnetd telnetd -b /etc/banner

/etc/banner can have your customized message

Remember to inetd -c after editing /etc/inetd.conf

Regards,
Javed Khan
Never Give Up
John Ferro
Regular Advisor

Re: How to: Display message before login prompt

Thanks mr. javed, but i didn't understand your steps, could you pls. explain in simple way and mulit lines...

Regads,
Matti_Kurkela
Honored Contributor

Re: How to: Display message before login prompt

"Bold" and "large fonts" are difficult to implement when using telnet, particularly in a message that is displayed before login.

The telnet protocol has no standard way of changing text attributes or font size: all this must be done using terminal control codes... and before login, you have no way of knowing the type of the client terminal (or terminal emulator). The terminal type of the client is identified only after login, when the /etc/profile script (or equivalent) runs the ttytype command. After that, the TERM environment variable is available and most tools use it to select the correct control codes automatically.

If you use the control codes of the most common terminal type, someone connecting with an uncommon terminal may see only garbage. You'll want your pre-login message to be readable by absolutely anyone, so it's best to keep it simple. This means US-ASCII only, no bold or font size tricks. You can use blank lines to make sure your message is visibly separated from any text above & below, and ALL CAPS or big ASCII art text if you feel you really need it.

If the message is needed for legal reasons, keep it as simple as possible: if it isn't readable with a single glance, your regular users will learn to ignore it completely within a week or so. In the first month or so they may still read it, but their brains will think only "blah blah, the standard message with no new information, where is the login prompt". After a month or so, their brains will recognize the general shape of the text block and skip over it, just like with Web ad banners.

---

Javed's instructions in a simpler format:

1.) Create a text file and write your message in it. (ASCII only, no .doc files or anything like that: just .txt)

2.) Move/rename the file to "/etc/banner"
(you can use a different name if you wish)

3.) Make a backup of your current /etc/inetd.conf, just in case:

cp /etc/inetd.conf /etc/inetd.conf.backup

4.) Edit /etc/inetd.conf. It should have a line like this:

telnet stream tcp nowait root /usr/lbin/telnetd telnetd

Change it to this:

telnet stream tcp nowait root /usr/lbin/telnetd telnetd -b /etc/banner

(if you used a different filename in step 2, use the correct filename instead of /etc/banner here too)

5.) After editing inetd.conf, run this command to make the changes effective immediately:

inetd -c

6.) Do not log out your current connection: open another telnet connection to test that your change works. If the banner is displayed and you can still log in, you're done.

If you cannot connect with telnet anymore, you made a bad mistake in editing the /etc/inetd.conf file. Use your first connection to restore the inetd configuration back to the original:

cp /etc/inetd.conf.backup /etc/inetd.conf
inetd -c

Then try again starting from step 4.

If you need to change your pre-login message, just edit /etc/banner. The change will be effective immediately.

MK
MK
Dennis Handly
Acclaimed Contributor

Re: How to: Display message before login prompt

>but I didn't understand your steps

Javed's steps are basically:
1) Edit /etc/inetd.conf, find the line with telnet.
2) Add "-b /etc/banner" to the end.
3) Create /etc/banner with your message
(I'm not sure how to do bold/large fonts.)
4) Do the following to activate: inetd -c
John Ferro
Regular Advisor

Re: How to: Display message before login prompt

Thanks Matti for your brief explinations. but how i could have Bold Text and Large size of fonts?

Regards,

Javed Khan_1
Valued Contributor

Re: How to: Display message before login prompt

Hi,

Your queries are well explained by Matti.

I also have no idea how to get the message in bold and large font however if you want to differentiate message content you can always use upper case and lower case letters.

I believe this should meet your requirement.

Regards,
Javed
Never Give Up
Bill Hassell
Honored Contributor

Re: How to: Display message before login prompt

Text-based logins such as telnet use the ASCII character set. The concept of bold and large fonts is completely meaningless. Features such as font size, color, etc, are not part of HP-UX but are features of your terminal emulator. For instance, there is nothing you can do to get a large font for hyperterminal, the emulator supplied with Windows PCs.

In order to provide enhanced displays, you must first find an emulator that can display special font characteristics like bold, color, size, blinking, inverse video, underlining, and so on. Then purchase copies for every user so there will only be one terminal emulator ever used to login to your system, and at that point, you can hard-code the special codes into the banner file.

By the way, the default (and preferred) pre-login message file is /etc/issue rather than /etc/banner. This file will be displayed before any login prompt. To make sure all logins use this file, modify the two lines in /etc/inetd.conf:

telnet stream tcp6 nowait root /usr/lbin/telnetd telnetd -b/etc/issue
login stream tcp6 nowait root /usr/lbin/rlogind rlogind -B /etc/issue

Now if installing new emulators for all of your users is not an option, you can use the banner program to draw very large words:

banner Private System > /etc/issue

You can then edit this file with additional comments. You can put many lines into this file.


Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: How to: Display message before login prompt

> [...] The concept of bold and large fonts
> is completely meaningless. [...]

No, it's just that the display capabilities
are determined by the display.

> [...] features of your terminal emulator
> [...]

Or your actual terminal. Some of us still
own hardware.

> [...] you must first find an emulator [...]

Or any collection of emulators (and/or actual
terminals) which offer the required
capabilities. I suspect that more than one
terminal or terminal emulator can deal with
the standard VT100 double-height line escape
sequences, and I suspect that several others
can not. On a DECterm on my VMS systems,
this works just fine:

dy # /bin/echo '\033#3fred\n\033#4fred'

On an hpterm (not known for its VT100
compatibility), it's a loser. An xterm does
a little better (but not much).

This may be the least commonly supported
character attribute in the VT100 collection,
but that's a long way from "only [...] one".
Frank de Vries
Respected Contributor

Re: How to: Display message before login prompt

We do it the very 'old fashioned' way

For bold (meaning it needs to stand out),
we simply d o u b l e s p a c e the characters.

Never heard any complaints ...
Look before you leap