Para mim, -o LogLevel=error
foi melhor que -q
, porque o último suprime as informações importantes sobre erros (que você pode obter apenas via código de saída).
Compare isto (sem opções):
[root@myserver804 myuser1]# ssh targetserver1; echo "exit code=$?"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:hvtR8Dl09aUeCeG2cT5EA8b+nbCOoV6h1DUON2vE63w.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:1735
RSA host key for targetserver1 has changed and you have requested strict checking.
Host key verification failed.
exit code=255
com isso (quieto)
[root@myserver804 myuser1]# ssh -q targetserver1; echo "exit code=$?"
exit code=255
com isso (apenas erros de log)
[root@myserver804 myuser1]# ssh -o LogLevel=error targetserver1; echo "exit code=$?"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:hvtR8Dl09aUeCeG2cT5EA8b+nbCOoV6h1DUON2vE63w.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:1735
RSA host key for targetserver1 has changed and you have requested strict checking.
Host key verification failed.
exit code=255
Portanto, a conclusão é: se você ainda estiver interessado em erros relevantes, use -o LogLevel=error
-q
ou-o LogLevel=error
grande trabalho agora :-)