ssh

All posts in this category.

Generate an ssh key pair with specific name

This command will generate an RSA SSH key pair with a key size of 4096 bits and save it to a file named « my-key-pair » in the current directory.

ssh-keygen -t rsa -b 4096 -f my-key-pair

Here’s a breakdown of the command:

  • ssh-keygen: This is the SSH key generation tool.
  • -t rsa: This specifies that we want to generate an RSA key pair.
  • -b 4096: This specifies the key size to use, which in this case is 4096 bits.
  • -f my-key-pair: This specifies the filename to use for the key pair. The public key will be saved to « my-key-pair.pub », while the private key will be saved to « my-key-pair ».

After running this command, you’ll be prompted to enter a passphrase for the private key. This is an optional step, but adding a passphrase can add an extra layer of security to your SSH key pair.

Once the key pair is generated, you can use the private key to connect to remote servers that have the corresponding public key added to their authorized keys list.