You can specify an SSH key pair when you create an ECS instance, or bind an SSH key pair to the instance after the instance is created. This topic describes how to bind an SSH key pair to an instance after the instance is created. If your ECS instance originally uses password-based authentication, the password-based authentication is automatically disabled after the key pair is bound.
Background information
Note After an SSH key pair is bound to a Linux instance, the public key of the key pair
is stored in the ~/.ssh/authorized_keys file. You can modify this file to add multiple key pairs or replace existing key
pairs. For more information, see Add or replace an SSH key pair.
Procedure
What to do next
- After an SSH key pair is bound to an ECS instance, you can log on to the ECS instance by using the SSH key pair. For more information, see Connect to a Linux instance by using an SSH key pair.
- If you want to log on to an instance by using the password after you bind a key pair to the instance, you can reset the instance password. Then, you can log on to the instance by using the key pair or the new password. For more information, see Reset the logon password of an instance.