SSH Keys
Generating and using SSH keys is a recommended practice for enhancing the security of remote logins, as it eliminates the need to use passwords, thereby reducing the risk of passwords being guessed or stolen. SSH keys can be used to securely log in to the code development environment. After setting up the SSH keys, you can log in to the code development environment via SSH without entering a password next time.
Path: Artificial Intelligence --- Basic Services --- SSH Keys
Key Pair Generation
In Windows, Linux, or macOS systems, you can use the ssh-keygen
command to generate an SSH key pair. This command is part of the OpenSSH suite and is usually pre-installed on Linux and macOS systems. For Windows users, if Git for Windows is installed, ssh-keygen
will also be installed accordingly.
Open the command-line terminal
-
On Windows, you can use Git Bash, CMD, or PowerShell.
-
On Linux and macOS, you can use the Terminal application.
Generate a new SSH key pair
Enter the following command in the terminal:
ssh-keygen -t rsa -b 2048
This will generate a 2048-bit RSA key pair.
Specify the key storage location and passphrase
When you run the ssh-keygen
command, it will prompt you to specify the storage location of the key and the passphrase.
If you accept the default location (usually the user's .ssh
directory), you can simply press the Enter key.
If you want to set a passphrase for the key, enter and confirm the passphrase when prompted.
Files after generating the key pair
After generating the key pair, you will find two files in the specified directory:
-
id_rsa
(orid_ecdsa
,id_ed25519
, depending on the algorithm you choose): This is your private key file and should be kept confidential and not shared with anyone. -
id_rsa.pub
(orid_ecdsa.pub
,id_ed25519.pub
): This is your public key file and can be safely shared.
Add the public key to the platform
In order to use SSH keys for passwordless login, you need to add the public key to the platform.