Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run login command on debian, I get:

hostname login: _

on RHEL5, Solaris or HP-UX I get:

login: _

I need to be able to customize login: and password: prompts it on a Linux box. I can recompile the package, but is there a better (easier) way to do it?

I was looking for some PAM config option but didn't find anything.

I know it can be done with the pam_set_item() function using PAM_USER_PROMPT constant, but is there a way to do such customization in a /etc/pam.d/* config file?

Thank you in advance.


I need this to customize telnet username and password prompt. However, telnetd is using /bin/login for that prompt, this is why I asked for login customization in this question.

share|improve this question

migrated from Oct 7 '11 at 11:25

This question came from our site for information security professionals.

I wasn't sure where to ask this question. I was considering also ServerFault, but I expected more PAM experts here. – Michał Šrajer Oct 7 '11 at 10:52
Are you wanting to change for console or ssh connection? – Bernie White Oct 7 '11 at 11:16
@BernieWhite: SSH is not an option (unfortunately). I need that for telnet server which (as far as I know) is using login binary. – Michał Šrajer Oct 7 '11 at 11:33
up vote 4 down vote accepted

You may try to change system locale to your custom locale containing desired labels.

share|improve this answer
Yes, I just noted that "login:" and "password:" from login is locale aware. This might be best alternative for a recompiling the package. – Michał Šrajer Oct 7 '11 at 14:43
It tuns out that "login: " is taken from /usr/share/locale-langpack/en/LC_MESSAGES/, while "Password: " is taken from another /usr/share/locale-langpack/en/LC_MESSAGES/ file. – Michał Šrajer Oct 7 '11 at 16:35

If you are using mingetty then you can specify the --nohostname parameter in /etc/inittab

1:2345:respawn:/sbin/mingetty --nohostname tty1
1:2345:respawn:/sbin/mingetty --nohostname tty2

          Do not print the hostname before the login prompt.
share|improve this answer
I cannot use mingetty. See comment for Mike's answer. – Michał Šrajer Oct 7 '11 at 14:06

if you use mgetty in /etc/inittab you can append the -p flag to change the login prompt

man mgetty

   -p <login prompt>
          Use the given string to prompt users for their login names. Various tokens are allowed in this string. These tokens are: @ for the system name, \n, \g, \f,  for  new-
          line, bell, and form feed, respectively.  \v and \r will expand to the OS version and release.  \P, \l and \L will expand to the tty name ("ttyS0").  \Y will give the
          Caller ID, \I the "CONNECT foobar" string returned by the modem, and \S or \b will output the port speed.  \N and \U give the number of users currently logged in.  \C
          will  be  changed  into  the result of ctime(), and \D or \d and \t or \T will output the date and time, respectively. Finally, \<digit> will use digit as octal/deci-
          mal/hexadecimal representation of the character to follow.

          The default prompt is specified at compile time.
share|improve this answer
Sorry, I cannot use mgetty. It's needed for telnetd login prompt customization, and telnet calls /bin/login. It must work with /bin/login alone. – Michał Šrajer Oct 7 '11 at 14:04

It have found that telnetd accepts -L /path/to/login option, so I have written few lines of python code to provide my own /bin/login alternative using PAM to authenticate and login -f to open a login shell.

In that python script I can define whatever prompt I need for both login: and password:.

share|improve this answer

According to the telnetd man page, with default options it asks for credentials, not login.

It also has this option:

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

Presumably you're invoking telnetd with that option - if you remove it does it give you the desired behaviour?

share|improve this answer
Thanks MikeyB. I need to change the prompt to something completely different. In other words, I need to be able to change prompt for example to: "Hello, what's your user name ?" and "your password please...". – Michał Šrajer Oct 7 '11 at 14:40

In theory, to change the Password: prompt, you can define a LOGIN_STRING in /etc/login.defs, something like this:

LOGIN_STRING        "%s, Please enter your password: "

(%s will be replaced by user name)

but in fact, this option seems obsolete and doesn't work anymore:

configuration error - unknown item 'LOGIN_STRING' (notify administrator)

It is also mentioned in /etc/login.defs:

# XXX - it doesn't work correctly yet, for now leave it commented out
# to use the default which is just "Password: ".

About the login: prompt, you can change it either by setting the PAM_USER_PROMPT or recompiling the login-utils package:

 * Provide a user prompt to PAM
 * so that the "login: " prompt gets localized. Unfortunately,
 * PAM doesn't have an interface to specify the "Password: " string
 * (yet).
retcode = pam_set_item(pamh, PAM_USER_PROMPT, _("login: "));
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.