This content originally appeared on DEV Community and was authored by Pheak Pheasa
To generate an SSH key in Ubuntu, you can follow these steps:
Open the Terminal: You can do this by pressing
Ctrl + Alt + T
or by searching for "Terminal" in your application menu.Generate SSH Key: Use the
ssh-keygen
command to generate a new SSH key pair.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
-
-t rsa
: Specifies the type of key to create (RSA is the most common). -
-b 4096
: Sets the key length to 4096 bits for added security. -
-C "your_email@example.com"
: This is a comment to help identify the key, typically using your email.
Save the Key: After running the command, you’ll be prompted to choose a location to save the key. Press
Enter
to accept the default location (~/.ssh/id_rsa
), or specify a different location.Set a Passphrase (optional): You will be asked to enter a passphrase. This adds an extra layer of security to your key. You can press
Enter
if you don't want a passphrase.View Your SSH Public Key: After the key is generated, you can display the contents of the public key file.
cat ~/.ssh/id_rsa.pub
- Copy the SSH Key to a Server (if needed): If you are setting up SSH keys for server access, you can copy the public key to the remote server using:
ssh-copy-id user@server_ip
After following these steps, your SSH key will be set up and ready to use for authentication.
This content originally appeared on DEV Community and was authored by Pheak Pheasa
Pheak Pheasa | Sciencx (2024-09-18T02:14:53+00:00) To generate an SSH key in Ubuntu. Retrieved from https://www.scien.cx/2024/09/18/to-generate-an-ssh-key-in-ubuntu/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.