When you create an ECS instance, the variables used in the user data of the instance are not specified.
cloud-init, during initialization, the script is executed as the root user, but the actual execution environment is not the environment where the environment variable is loaded after the root login, so there is no HOME variable with the value
Alibaba Cloud reminds you that:
- Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
When writing a custom script for cloud-init, you must define the "HOME" variable in the script if you need to.
- Elastic Compute Service