Linux Password Less Authentication (rsa key file): Difference between revisions
Created page with "=== '''Generate the SSH key pair on your local machine''' (the one you want to connect from): === ssh-keygen -t rsa -b 4096 -f ~/.ssh/username * <code>-t rsa</code>: Specifies the RSA algorithm (you can also use <code>ed25519</code> for better security). * <code>-b 4096</code>: Sets the key size (4096 bits for RSA). * <code>-f ~/.ssh/username</code>: This option lets you set the filename and path for the key. Here, it will save the private key as <code>~/.ssh/username<..." |
No edit summary |
||
Line 1: | Line 1: | ||
# Create key pair | |||
ssh-keygen -t rsa -b 4096 -f ~/.ssh/username | ssh-keygen -t rsa -b 4096 -f ~/.ssh/username | ||
# Add the public key to the `authorized_keys` file | |||
cat ~/.ssh/username.pub >> ~/.ssh/authorized_keys | |||
chmod 700 ~/.ssh # Set the directory permissions | |||
chmod 600 ~/.ssh/authorized_keys # Set the file permissions | |||
Latest revision as of 16:50, 7 November 2024
# Create key pair ssh-keygen -t rsa -b 4096 -f ~/.ssh/username # Add the public key to the `authorized_keys` file cat ~/.ssh/username.pub >> ~/.ssh/authorized_keys chmod 700 ~/.ssh # Set the directory permissions chmod 600 ~/.ssh/authorized_keys # Set the file permissions