Help Center/ Migration Center/ MgC Agent Usage Guide/ FAQs/ How Do I Set Environment Variables to Collect and Migrate Linux Servers That Use OpenSSH Earlier Than 7.0?
Updated on 2025-08-25 GMT+08:00

How Do I Set Environment Variables to Collect and Migrate Linux Servers That Use OpenSSH Earlier Than 7.0?

MgC supports collection and migration for Linux distributions and versions that use OpenSSH 7.0 or later. If a source server uses OpenSSH earlier than 7.0, you need to add environment variables to the server where the MgC Agent is installed to ensure compatibility.

Procedure

The procedure depends on the OS where the MgC Agent is installed.

  1. Stop the MgC-Agent.

    1. Open the Task Manager on the Windows server where the MgC Agent is installed.
    2. On the Services tab, find the MgC-Agent service.
    3. Right-click this service and choose Stop to stop the MgC Agent.

  2. Add system environment variables.

    1. Press Win+R to open the Run window.
    2. Enter sysdm.cpl and press Enter to open the System Properties window.
    3. Click the Advanced tab and click Environment Variables.
    4. In the System variables area, click New and add the variables listed in the table below. The default values of these variables are provided by MgC. You need to adjust the values according to the algorithms supported by the source system.
      Table 1 Default variable values

      Variable Name

      Variable Value (Default)

      EDGE_JSCH_SERVER_HOST_KEY

      -Djsch.server_host_key=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256

      EDGE_JSCH_CLIENT_PUB_KEY

      -Djsch.client_pubkey=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256

      MGC_MAC_ALGORITHM

      hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,umac-128@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96,aes256-gcm@openssh.com, aes128-gcm@openssh.com

    5. After adding all variables, click OK to save the environment variables.

  3. Restart the MgC Agent.

    1. Open the task manager of the server where the MgC Agent was installed.
    2. On the Details tab, right-click MgC-Agent and choose Start from the shortcut menu.
    3. After the MgC Agent is started, go to the login page.

  4. (Optional) If an error is still reported during subsequent collection and migration after the preceding steps are performed, continue to configure the environment variables of the Windows server as follows:

    1. In the MgC Agent log file C:\MgC-Agent\logs\agent-server\run.log, find the line that contains the following error information:
      • algorithmName="server_host_key"
      • algorithmName="PubkeyAcceptedAlgorithms"
      • algorithmName="mac.c2s"
    2. View the algorithm list following serverProposal= and find the algorithms that are not in the Default variable values. Then, select a troubleshooting method based on the actual error information by referring to Table 2.

      For example, the algorithm list following serverProposal= contains ed25519, but this algorithm is not in the "Default variable values" table.

      Table 2 Error information and troubleshooting methods

      Error Message

      Troubleshooting Method

      • algorithmName="server_host_key"
      • algorithmName="PubkeyAcceptedAlgorithms"

      Add algorithms (for example, ed25519) that are not in the "Default variable values" table to the values of the EDGE_JSCH_SERVER_HOST_KEY and EDGE_JSCH_CLIENT_PUB_KEY variables added in step 2.

      algorithmName="mac.c2s"

      Add algorithms (for example, ed25519) that are not in the "Default variable values" table to the value of the MGC_MAC_ALGORITHM variable added in step 2.

    3. After updating the variable values, click OK to save the environment variables.
    4. Restart the MgC Agent by referring to step 3, and then continue the collection and migration.

  1. On the server where the MgC Agent is installed, run the following command to stop the MgC Agent:

    sh /opt/cloud/MgC-Agent/scripts/stop.sh

  2. Run the following commands to add the three system environment variables below. The default values of these variables are provided by MgC. You need to adjust the values according to the algorithms supported by the source system.

    echo "export EDGE_JSCH_SERVER_HOST_KEY=-Djsch.server_host_key=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256" >> /opt/cloud/MgC-Agent/scripts/setenv.sh
    echo "export EDGE_JSCH_CLIENT_PUB_KEY=-Djsch.client_pubkey=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256" >> /opt/cloud/MgC-Agent/scripts/setenv.sh
    echo "export MGC_MAC_ALGORITHM=hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,umac-128@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96,aes256-gcm@openssh.com, aes128-gcm@openssh.com" >> /opt/cloud/MgC-Agent/scripts/setenv.sh

  3. Go to the scripts directory in the MgC Agent installation directory.

    cd /opt/cloud/MgC-Agent/scripts/

  4. Run the following command to start the MgC Agent:

    ./start.sh

    If the following information is displayed, the MgC Agent is started.

  5. Run the following command to view the MgC Agent process:

    ps -ef |grep mgcagent

    If the following information is displayed, the MgC Agent process is started.

  6. (Optional) If an error is still reported during subsequent collection and migration after the preceding steps are performed, continue to configure the environment variables of the Linux server as follows:

    1. In the MgC Agent log file /opt/cloud/MgC-Agent/logs/agent-server/run.log, find the line that contains the following error information:
      • algorithmName="server_host_key"
      • algorithmName="PubkeyAcceptedAlgorithms"
      • algorithmName="mac.c2s"
    2. View the algorithm list following serverProposal= and find the algorithms that are not in the default variable values provided in step 2. Then, select a troubleshooting method based on the actual error information by referring to Table 3.

      For example, the algorithm list following serverProposal= contains ed25519, but this algorithm is not in the "Default variable values" table.

      Table 3 Error information and troubleshooting methods

      Error Message

      Troubleshooting Method

      • algorithmName="server_host_key"
      • algorithmName="PubkeyAcceptedAlgorithms"

      Add algorithms (for example, ed25519) that are not in the "Default variable values" table to the values of the EDGE_JSCH_SERVER_HOST_KEY and EDGE_JSCH_CLIENT_PUB_KEY variables added in step 2.

      algorithmName="mac.c2s"

      Add algorithms (for example, ed25519) that are not in the "Default variable values" table to the value of the MGC_MAC_ALGORITHM variable added in step 2.

    3. Restart the MgC Agent by referring to steps 3 to 5, and then continue the collection and migration.