Junior — Middle
What methods can be used for authentication in SSH?
sobes.tech AI
Answer from AI
SSH authentication can be performed using the following main methods:
- Password authentication — the user enters a password to access the server.
- Public Key Authentication — a pair of keys is used: a private key stored on the client, and a public key on the server. During connection, the keys are verified for correspondence.
- Kerberos authentication — integration with Kerberos for single sign-on (SSO).
- X.509 certificate authentication — less common, but possible.
In practice, key-based authentication is most often used because it is more secure and convenient for automation.
Example of setting up key-based authentication:
# Generate a key on the client
ssh-keygen -t rsa -b 4096
# Copy the public key to the server
ssh-copy-id user@server
# Connect to the server
ssh user@server