Some days ago I’ve written a documentation to instruct how to use SSH with Bluehost. In that article, I told about 2 methods to login into SSH Server and promised that I would write a next article to compare the security between using password and using public key in aspect of security. However I found a good book about SSH. It discussed very clearly about this problem and SSH Protocol. So I decide just to extract some main idea from that book below.
• In order for a password to be secure, it should be long and random, but such passwords are hard to memorize.
• A password sent across the network, even protected by an SSH secure channel, can be captured when it arrives on the remote host if that host has been compromised.
• Most operating systems support only a single password per account. For shared accounts (e.g., a superuser account), this presents difficulties:
— Password changes are inconvenient because the new password must be communicated to all people with access to the account.
— Tracking usage of the account becomes difficult because the operating system doesn’t distinguish between the different users of the account.
Using public key
To address these problems, SSH supports public-key authentication: instead of relying on the password scheme of the host operating system, SSH may use cryptographic keys. Keys are more secure than passwords in general and address all the weaknesses mentioned earlier.
Public-key authentication is more secure than password authentication because:
• It requires two secret components—the identity file on disk and the passphrase in your head— so both must be captured in order for an adversary to access your account. Password authentication requires only one component, the password, which might be easier to steal.
• Neither the passphrase nor the key is sent to the remote host, just the authenticator discussed earlier. Therefore, no secret information is transmitted off the client machine.
• Machine-generated cryptographic keys are infeasible to guess. Human-generated passwords are routinely cracked by a password-guessing technique called a dictionary attack. A dictionary attack may be mounted on the passphrase as well, but this requires stealing the private key file first.
You can follow this link to that book SSH, The Secure Shell: The Definitive Guide