文档首页/ 迁移中心 MgC/ 迁移中心Agent操作指南/ 常见问题/ 如何通过设置环境变量以采集和迁移OpenSSH版本低于7.0的Linux主机
更新时间:2025-08-19 GMT+08:00
分享

如何通过设置环境变量以采集和迁移OpenSSH版本低于7.0的Linux主机

迁移中心支持采集和迁移OpenSSH版本不低于7.0的Linux主机。如果源端主机使用的是低于7.0版本的OpenSSH,需要在安装迁移中心Agent的主机上添加环境变量,以确保兼容性。

操作步骤

请根据安装MgC Agent的实际系统版本进行操作。

  1. 关闭MgC-Agent。

    1. 打开安装MgC Agent的Windows主机任务管理器。
    2. 切换到“服务”选项卡,找到MgC-Agent服务。
    3. 右键单击该服务,选择“停止”以关闭MgC Agent。

  2. 新增系统环境变量。

    1. 按下“Win+R”键,打开运行窗口。
    2. 输入“sysdm.cpl”,按Enter键,打开系统属性窗口。
    3. 选择“高级”选项卡,单击“环境变量”按钮,打开环境变量窗口。
    4. 在“系统变量”区域,单击“新建”按钮,添加下表中的三个变量。变量值为常见算法示例,请根据源端系统实际支持的算法列表进行调整。

      变量名

      变量值(示例)

      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. 添加完所有变量后,单击“确定”,保存环境变量。

  3. 重启MgC-Agent。

    1. 打开MgC Agent所在主机的“任务管理器”。
    2. 切换到“服务”选项卡,找到名为“MgC-Agent ”的服务,鼠标右键,单击“开始”,即可手动启动MgC Agent进程。
    3. 重新打开MgC Agent,进入登录页面。

  1. 在安装MgC Agent的主机,执行如下命令,关闭MgC-Agent。

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

  2. 分别执行以下三条命令,新增三个系统环境变量。其中变量值为常见算法示例,请根据源端系统实际支持的算法列表进行调整。

    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. 执行如下命令,进入MgC Agent安装目录中的scripts目录。

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

  4. 执行如下命令,启动MgC Agent。

    ./start.sh

    当出现如下图所示提示时,表示MgC Agent已经启动。

  5. 执行如下命令,查看MgC Agent进程。

    ps -ef |grep mgcagent

    当出现如下图所示提示时,表示MgC Agent进程已经启动。

相关文档