Create New Key Pair for SSH
Create the Key Pair
Bash
# No comment, no password on key file, output to current directory as my_ssh_key
ssh-keygen -t rsa -b 4096 -C "" -f "~/my_ssh_key.rsa" -N ""
PowerShell
# No comment, no password on key file, output to current directory as my_ssh_key
ssh-keygen -t rsa -b 4096 -C '""' -f "my_ssh_key" -N '""'
Configure SSH Host(s)
In the above example, we're creating a key pair with the filename, my_ssh_key
, which will generate the following key files:
my_ssh_key
my_ssh_key.pub
Copy the public key string in my_ssh_key.pub
and paste it into the authorized_keys
file of the user account on the target system(s) where you intend to SSH with this key.
Then use the private key file with this syntax to SSH as said user on the remote host(s):
# FQDN
ssh -i my_ssh_key username@hostname.domain.tld
# IP
ssh -i my_ssh_key username@192.168.10.125