Score:1

Can I set a limit on attempt number of ssh authentication passphrase?

id flag

I recently changed to ssh-key from password for security.

But ssh-key can also be compromised when the private key file is somehow stolen.

So I set a passphrase on the private key.

But it seems that I can try as many as I wish.

So is there any way I can set a limit on how many one can try passphrase?

Grace Thompson avatar
gp flag
Not that I am aware of, but if you chose a secure passphrase it would be very hard (read: impossible) to brute force. Think 'as9h8J)F(DS*(dsh*' and not 'monkey123'.
Score:4
ar flag

No, you can't.

The passphrase is used to add a layer of encryption to the key. The process is completely offline, and the methods employed are well known, as the software is open source. It's basically a function taking the key and passphrase as input, and returning unencrypted key.

As it's completely offline there's no meaningful way to limit the number of attempts.

id flag
Well understood. Is there any other way to put another security layer? maybe something in ~/.bashrc that runs automatically after ssh-login is sucessful might do unless there is a way to break out of it, for example pressing CTRL+C
vidarlo avatar
ar flag
You could store the key on a smart card so that noone can copy it. https://developers.yubico.com/PGP/SSH_authentication/
A.B avatar
cl flag
A.B
@KHKim You can also combine multiple authentications at once. For example key AND standard password (some information in `man sshd_config` at the AuthenticationMethods entry).
id flag
@A.B Thank you for the tip. You made my day.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.