A sessão de perguntas e respostas de hoje nos é oferecida por cortesia do SuperUser, uma subdivisão do Stack Exchange, um agrupamento de sites de perguntas e respostas conduzido pela comunidade.
A questão
SuperUser reader user110971 quer saber como manter as senhas invisíveis ao executar um comando como um argumento SSH:
If I run this command and start typing the MySQL password, the password is visible on the screen:
ssh user@server ‘mysql -u user -p’
How can I prevent this? If I log in through SSH and execute the MySQL command, then everything works fine.
Como você pode manter as senhas invisíveis ao executar um comando como um argumento SSH?
A resposta
O colaborador do SuperUser Toby Speight tem a resposta para nós:
If you provide a remote command to run, SSH does not allocate a tty, so the remote command is unable to disable echo. You can force SSH to provide a tty using the -t option:
ssh -t user@server ‘mysql -u user -p’
The equivalent option (for -o or for the config file) is RequestTTY. I would caution against using it in the config file because it can have unwanted effects for non-interactive commands.
Tem algo a acrescentar à explicação? Som desligado nos comentários. Quer ler mais respostas de outros usuários do Stack Exchange com experiência em tecnologia? Confira o tópico de discussão completo aqui.
Crédito de imagem: Screenshots do Linux (Flickr)