Você pode tentar alterar a localidade do sistema para a sua localidade personalizada contendo as etiquetas desejadas.
Quando executo o comando login
no debian, recebo:
hostname login: _
no RHEL5, Solaris ou HP-UX eu recebo:
login: _
Eu preciso personalizar o login:
e password:
em uma caixa do Linux. Eu posso recompilar o pacote, mas existe uma maneira melhor (mais fácil) de fazê-lo?
Eu estava procurando por alguma opção de configuração do PAM, mas não encontrei nada.
Eu sei que isso pode ser feito com a função pam_set_item () usando PAM_USER_PROMPT
constant, mas existe uma maneira de fazer tal customização em um arquivo /etc/pam.d/*
config?
Obrigado antecipadamente.
ATUALIZAÇÃO:
Eu preciso disso para personalizar o prompt de nome de usuário e senha do telnet. No entanto, telnetd
está usando /bin/login
para esse prompt, por isso solicitei login
de personalização nessa questão.
Se você estiver usando mingetty
, poderá especificar o parâmetro --nohostname
em /etc/inittab
1:2345:respawn:/sbin/mingetty --nohostname tty1
1:2345:respawn:/sbin/mingetty --nohostname tty2
--nohostname
Do not print the hostname before the login prompt.
se você usar o mgetty em / etc / inittab, você pode anexar o sinalizador -p para alterar o prompt de login
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.
Descobrimos que telnetd
aceita a opção -L /path/to/login
, por isso escrevi algumas linhas de código python para fornecer minha própria alternativa /bin/login
usando o PAM para autenticação e login -f
para abrir um shell de login.
Nesse script python, posso definir qualquer prompt que eu precisar para login:
e password:
.
De acordo com a página telnetd
man, com as opções padrão, ele solicita credenciais, não login
.
Ele também tem essa opção:
-h Disables the printing of host-specific information before login
has been completed.
Presumivelmente, você está invocando telnetd
com essa opção - se você remover, isso lhe dará o comportamento desejado?
Em teoria, para alterar o prompt Password:
, você pode definir um LOGIN_STRING
em /etc/login.defs
, algo assim:
LOGIN_STRING "%s, Please enter your password: "
( %s
será substituído pelo nome do usuário)
mas, de fato, essa opção parece obsoleta e não funciona mais:
configuration error - unknown item 'LOGIN_STRING' (notify administrator)
Também é mencionado em /etc/login.defs
:
# XXX - it doesn't work correctly yet, for now leave it commented out
# to use the default which is just "Password: ".
Sobre o prompt login:
, você pode alterá-lo configurando o PAM_USER_PROMPT
ou recompilando o pacote login-utils
:
/*
* [email protected]: 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: "));
PAM_FAIL_CHECK;