O login do MySQL através do switch -p é inseguro?

4

Eu quero entrar em um banco de dados MySQL de um shell.

Normalmente eu uso

mysql -p 

Mas eu notei o seguinte na ajuda do MySQL:

-p, --password[=name] 
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty. WARNING: This is
                      insecure as the password is visible for anyone through
                      /proc for a short time.

Isto está dizendo que o seguinte é inseguro?

mysql -p=mypassword

Ou que todos os usos de -p são inseguros?

    
por bryan 30.08.2011 / 14:42

1 resposta

6

Apenas isso é inseguro:

mysql -p=mypassword

porque desta forma pode ser visível quando ps é usado para visualizar os argumentos da linha de comando. Em suma, use sempre a opção -p , e quando a automação for desejada use um "arquivo de opções"

Consulte o link para obter mais informações:

This is convenient but insecure, because your password becomes visible to system status programs such as ps that may be invoked by other users to display command lines. MySQL clients typically overwrite the command-line password argument with zeros during their initialization sequence. However, there is still a brief interval during which the value is visible. Also, on some systems this overwriting strategy is ineffective and the password remains visible to ps. (SystemV Unix systems and perhaps others are subject to this problem.)

    
por 30.08.2011 / 15:47