Creating Scripts in Agent Images
Precautions
- You need to prepare required scripts on your own. If you need help, contact SMS technical support.
- The script examples below are only for reference.
- You can use the scripts contained in SMS agent images as the basis to create your own scripts. For details, see Obtaining SMS Agent Image Scripts for Testing Use.
Linux
- In the ~ directory, create a folder and name it smsMetadataAgent. In this folder, create three folders and name them bin, Python, and smsAgent respectively.
Folder
Function
Location
bin
Stores the startup scripts and the peagent folder.
~\smsMetadataAgent\bin
smsAgent
Stores Python scripts for obtaining metadata.
~\smsMetadataAgent\smsAgent
- Prepare scripts for obtaining public and private keys from metadata.
Script
Function
Destination File
sms_rsa_part (to be deprecated)
Obtains SSH public keys (for server and identity authentication).
root/.ssh/authorized_keys, /etc/ssh/ssh_host_rsa_key.pub
sms_rsa_pri_part (to be deprecated)
Obtains SSH private keys (for server and identity authentication).
/etc/ssh/ssh_host_rsa_key
sms_rsa_host_old
Obtains new SSH public keys (for server authentication).
/etc/ssh/ssh_host_rsa_key.pub
sms_rsa_host_old_pri
Obtains new SSH private keys (for server authentication).
/etc/ssh/ssh_host_rsa_key
sms_rsa_identity
Obtains SSH public key certificates (for identity authentication).
/root/.ssh/authorized_keys
cert_part (to be deprecated)
Obtains TSL 1.2 authentication public keys.
/home/config/cert.pem
prikey_part (to be deprecated)
Obtains TSL 1.2 authentication private keys.
/home/config/prikey.pem
Prepare Linux startup scripts.
Obtaining SMS Agent Image Scripts for Testing Use
- Log in to the SMS console. In the navigation pane on the left, choose Agents.
- Install and start SMS-Agent. For details, see Linux.
- Enter the AK/SK pair and SMS domain name to start the SMS-Agent.
- Switch back to the SMS console, create a migration task for the source server, and start the task. In this example, an existing ECS is used as the target server. You can also choose to create a new ECS as the target server.
- When the progress of the Mount the Agent image and relaunch the target subtask is 60%, click Pause.
- Check the target server that has a temporary system disk.
- Log in to the target server and obtain SMS scripts for testing use.
In Linux, the scripts are stored in ~\smsMetadataAgent.
CautionWhen logging in to the target server, you need to use the password reset plug-in to reset the password. If the password cannot be reset, you can recreate a migration task for the source server and choose to create a new ECS as the target server. Then obtain the login password from SMS.
Location of scripts in Linux
- Precautions
- Linux
- Obtaining SMS Agent Image Scripts for Testing Use