使用源和目标上堡垒主机和数据库主机的正确 IP 地址编辑脚本。如果您可以从本地计算机访问源数据库和目标数据库,请在本地重用 ZDM 服务工具公钥并将其同时添加到源主机和目标主机。
# exit out of the zdmuser shell
exit
# copy the public key to the opc user for download
sudo cp /home/zdmuser/.ssh/id_rsa.pub /home/opc
# exit the opc user shell, back to local host
exit
# copy the public key to the source and target hosts into authorized_keys file
ZDM_SERVICE_IP=ZDM_Service_IP_Address
SOURCE_DB_IP=
SOURCE_DB_BASTION=
TARGET_DB_IP=Target_DB_IP_Address
TARGET_DB_BASTION=
ZDM_USER=opc
SOURCE_USER=opc
TARGET_USER=opc
ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh/id_rsa.pub' | ssh -J
${SOURCE_USER}@${SOURCE_DB_BASTION} ${SOURCE_USER}@${SOURCE_DB_IP} 'cat >>
~/.ssh/authorized_keys'
ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh /id_rsa.pub' | ssh -J
${TARGET_USER}@${TARGET_DB_BASTION} ${TARGET_USER}@${TARGET_DB_IP} 'cat >>
~/.ssh/authorized_keys'