How to disable the try again password in ssh command
In the sshd config man page man 5 sshd_config
:
MaxAuthTries
Specifies the maximum number of authentication attempts permitted
per connection. Once the number of failures reaches half this
value, additional failures are logged. The default is 6.
So a setting of MaxAuthTries 2
will be the setting you will need. sshd
will need to be
restarted afterwards (has to be ran as root):
/etc/init.d/ssh restart
or
service ssh restart
On the client side this can set with ssh settings (look at man 5 ssh_config
for the settings you can apply):
NumberOfPasswordPrompts
Specifies the number of password prompts before giving up. The
argument to this keyword must be an integer. The default is 3.
So edit your ~/.ssh/config
file and add:
Host <name_or_ip_of_host|*>
NumberOfPasswordPrompts 1
Where <name_or_ip_of_host|*>
the canonical IP or hostname you are using on the command line, or *
for all host connection attempts. You can also specify this on the command line without having to edit your /.ssh/config
file:
ssh -o NumberOfPasswordPrompts=1 user@hostname