How to create SSH Key for connecting to the instance.
On Linux or macOS, we can generate a key with the ssh-keygen command.
Open a terminal and then use the ssh-keygen command to generate a new key. Specify the -C flag to add a comment with your username.
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
where:
[KEY_FILENAME] is the name that you want to use for your SSH key files. For example, a filename of myserver-ssh-key generates a private key file named myserver-ssh-key and a public key file named myserver-ssh-key.pub.
[USERNAME] is the username on the instance.
This command generates a private SSH key file and a matching public SSH key with the following structure:
ssh-rsa [KEY_VALUE] [USERNAME]
where:
[KEY_VALUE] is the key value that you generated.
[USERNAME] is the user on instance that this key applies to.
Restrict access to your private key so that only you can read it and nobody can write to it.
chmod 400 ~/.ssh/[KEY_FILENAME]
Locate the public SSH keys to add to instance. It can be done via menu edit instance to place the public SSH key.
Open a terminal and then use the ssh-keygen command to generate a new key. Specify the -C flag to add a comment with your username.
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
where:
[KEY_FILENAME] is the name that you want to use for your SSH key files. For example, a filename of myserver-ssh-key generates a private key file named myserver-ssh-key and a public key file named myserver-ssh-key.pub.
[USERNAME] is the username on the instance.
This command generates a private SSH key file and a matching public SSH key with the following structure:
ssh-rsa [KEY_VALUE] [USERNAME]
where:
[KEY_VALUE] is the key value that you generated.
[USERNAME] is the user on instance that this key applies to.
Restrict access to your private key so that only you can read it and nobody can write to it.
chmod 400 ~/.ssh/[KEY_FILENAME]
Locate the public SSH keys to add to instance. It can be done via menu edit instance to place the public SSH key.
Komentar