Operating System - HP-UX
1836579 Members
1677 Online
110102 Solutions
New Discussion

How do I change login prompt for Unix servers

 
SOLVED
Go to solution
Mangesh Yadav
Occasional Advisor

How do I change login prompt for Unix servers

When you login to a server, you see the default login prompt (e.g. login: )
How do I change this?
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: How do I change login prompt for Unix servers

By writing a custom login program but you will probably break many applications and scripts that are looking for "login:". You may want to put an entry in the file /etc/issue which will be output befor the login prompt.
If it ain't broke, I can fix that.
Jaime Bolanos Rojas.
Honored Contributor

Re: How do I change login prompt for Unix servers

Mangesh,

I was wondering what you are trying to accomplish, but what most of the people wants is to change the motd. For more information on this please refer to the following link:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=150225

Regards,

Jaime.
Work hard when the need comes out.
Bill Hassell
Honored Contributor

Re: How do I change login prompt for Unix servers

The word: login is hardcoded into the login program so there is no customization possible. However, there are two files that may be customized. Before the login prompt, the file: /etc/issue is displayed. Here, you can put a small amount of information, perhaps the server name but nothing else. The default text in this file is often the text from uname -a, but this is a bad idea as anyone can determine the OS and version without a login.

The second file is /etc/motd which is displayed AFTER a successful login. This is usually a security message and perhaps news about this particular server. Avoid words like welcome in the message file for security reasons.


Bill Hassell, sysadmin
Geoff Wild
Honored Contributor

Re: How do I change login prompt for Unix servers

What I do is have an /etc/opt/issue file that is called from sshd


In sshd_config, add:

# Banner to be printed before authentication starts.
Banner /etc/opt/issue

# cat /etc/opt/issue

ABC Private Network / Réseau privé de ABC
Avis:
L'utilisation des systèmes de ABC est réservée à des fins commerciales.

Toute utilisation peut faire l'objet d'une surveillance pour assurer
le respect des normes de sécurité et d'exploitation. Par conséquent,
les communications, y compris le transfert de données et le courrier
électronique, ne devraient pas être considérées privées.

Notice:
Use of ABC's systems is intended for business purposes.

All use can and may be monitored for security and operational
compliance and therefore communication, including data transfer
and electronic mail, should not be considered to be private.


What happens is, that is displayed before you are prompted for a password.

Don't change login - security through obscurity is lame.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How do I change login prompt for Unix servers

There is one other state-of-the-art stupid way to do what you want. Use a hex editor (e.g. hexedit) to modify /usr/bin/login and actually change "login:" to something else. To avoid catastrophic damage, you should replace "login:" with a string of exactly the same length (or shorter if you terminate with a NUL). However, the real way to do what you want is to write your own login program. That used to be fairly common when you wanted to add additional security features that were not available until shadowed password files or trusted systems came along and is still fairly common in those sites which use NIS but want features like password history or password composition rules.
If it ain't broke, I can fix that.
Mangesh Yadav
Occasional Advisor

Re: How do I change login prompt for Unix servers

I have installed hexedit and done changes in /usr/bin/login.

Thanks to clay

Regards,
Mangesh
Dennis Handly
Acclaimed Contributor

Re: How do I change login prompt for Unix servers

You might want to look at your duplicate thread where it mentions editing pam_unix.cat:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1147798