SSH
Andy Brown · 25/06/2024 · 1 min read
Create new SSH directory
- Create an SSH directory if it doesn't exist:
mkdir -p ~/.ssh
. - Ensure the SSH directory has the correct permissions:
chmod 700 ~/.ssh
.
Check for existing SSH keys
Navigate to ~/.ssh
. If it contains files named id_rsa
and id_rsa.pub
, these are the default private and public SSH keys respectively. You can use the same key pair for multiple systems or services, but this isn't the best for security if the key is compromised.
Creating a new SSH key pair
ssh-keygen -t rsa -b 4096 -C "youremail@example.com" -f ~/.ssh/custom_service_key
-
-t
option stands fortype
. RSA is one of the most widely used encryption algorithms. -
-b
stands forbits
. -
-C
stands forcomment
, and is useful for idendifying which key is which, especially when you have multiple keys. -
-f
stands for file name. The private key will be saved as~/.ssh/custom_service_key
and the public key as~/.ssh/custom_service_key.pub
.
Sharing public key
cat ~/.ssh/id_rsa.pub
Discussions
Login to Post Comments