- Documentation
Elastic Compute Service
Elastic Compute Service
Best Practices
Instance configuration
Creating accounts to log in to ECS instances
Instance configuration
Creating accounts to log in to ECS instances
Creating accounts to log in to ECS instances
Linux instances use the root administrator account for login by default, and Windows instances use the Administrator account. Both have the highest administrative privileges of the operating system. To enhance instance security and manage user permissions hierarchically, you can create accounts in the instance by following this guide.
Create account in Linux instance
In the example provided in this topic, CentOS Stream 8 is used.
Login with password
Login with key
tip
You can create new accounts only as the root account or an account with sudo permissions.
- Execute the following command to create the new account.
- Execute the following command to set the new account password, and enter the password twice as prompted to confirm the password.
tip
You can also execute this command to change the password by resetting the password.
- Click "Confirm". If the following information is returned, you have logged in to the instance as the new account.
-
tip
You can create new accounts only as the root account or an account with sudo permissions.
- Execute the following commands for creating a new account, switching to the directory of the new account, and viewing the directory path, respectively.
- Execute the following commands to create the .ssh directory for storing the key pair and grant the appropriate permissions to it.
- Execute the following command to log out of the new account.
tip
Switch to the root user by default.
- Execute the commands to copy the "authorized_keys" file to the ".ssh" directory of the new account, and switch to the ".ssh" directory, respectively.
- Execute the following command to view which user and group the "authorized_keys" file is associated with.
tip
If the associated group does not belong to the new account, execute the chown <new user name>:<new user name> authorized_keys command to modify accordingly.
-
- Click "Confirm". If the following information is returned, you have logged in to the instance as the new account.
-
Create account in Windows instance
In the example provided in this topic, the Chinese edition of Windows Server 2022 is used.
tip
You can create new accounts only with the Administrator account or an account granted administrator permissions.
- Select "Start > Settings > Accounts".
- Select "Other people > Add someone else to this PC".
- Select "Users > More Actions > New user...".
- Enter the username and password of the new account.
- Click the "Create" button to close the current window. Then, you can view the newly created account.
- Click "Groups", find the three groups in the picture below, and then perform as follows in sequence.
- Select the item, right-click, and then choose "Add to Group...".
- Click "Add...", enter the name of the newly created account, and click "Check Names". Then, the information of the new account appears.
- Click "OK" twice. Then, the new account is created.
- Click "Confirm" to log in to the instance as the new account.
Last updated: 2026.06.18 17:49:49