Configuring Local SSH Login with Public and Private Keys
Procedure
Configuring local SSH login with public and private keys (on Windows)
- Generate a public-private key pair.
On Windows, run ssh-keygen -b 3072 -t rsa in the CLI to create a public-private key pair. Press Enter to proceed. By default, the created public-private key pair is stored in the id_rsa and id_rsa.pub files in ~/.ssh/.
- Copy the local .ssh folder to the SSH server (the remote environment to be connected) and import the content of the public key file to the authorized_keys file.
1 2
cd ~/.ssh cat id_rsa.pub >> authorized_keys
- Configure the directory permissions.
- Set the permission for the SSH server user directory to 700.
1chmod 700 ~
- Set the permission for the .ssh directory to 700.
1chmod 700 ~/.ssh
- Set the permission for the authorized_keys file to 600.
1chmod 600 ~/.ssh/authorized_keys
- Set the permission for the SSH server user directory to 700.
Parent topic: Common Operations