Disabling the display of the user name and changing the password prompt

In a secure environment, it might be necessary to hide the display of the login user name or to provide a custom password prompt that differs from the default.

The default message behavior for the login and password prompt is shown below:

login: foo
foo's Password:

To disable the display of the user name from prompts and system error messages, edit the usernameecho parameter in the /etc/security/login.cfg file. The default value for usernameecho is true which results in the user name being displayed. To change this parameter, you can either use the chsec command or edit the file directly.

The following example uses the chsec command to change the default usernameecho parameter to false:

# chsec -f /etc/security/login.cfg -s default -a usernameecho=false

To edit the file directly, open the /etc/security/login.cfg file and add or modify the usernameecho parameter as follows:

default:
 usernamecho = false

Setting the usernameecho parameter to false will result in the user name not being displayed at the login prompt. Instead, the user name is masked out with '*' characters for system prompts and error messages as show below:

login:
***'s Password:

The password prompt may be separately modified to be a custom string by setting the pwdprompt parameter in the /etc/security/login.cfg file. The default value is a string "user's Password: " where user is replaced with the authenticating user name.

To change this parameter, you can either use the chsec command or edit the file directly.

The following example uses the chsec command to change the default pwdprompt parameter to "Password: ":

# chsec -f /etc/security/login.cfg -s default -a pwdprompt="Password: "

To edit the file directly, open the /etc/security/login.cfg file and add or modify the pwdprompt parameter as follows:

default:
 pwdprompt = "Password: "

Setting the pwdprompt parameter to "Password: " will result in the specified prompt being displayed by login as well as by other applications that use the system password prompt. The prompt behavior for the login when the a custom prompt has been configured is as follows:

login: foo
Password: