1. generate ssh on remote -host and copy it on server
ex> prompt>ssh-keygen -t rsa
ex> prompt>ssh-keygen -t rsa
2. copy private key on server
ex> cat ~/.ssh/id_rsa
3. install ssh client ( ssh-agent, ssh-add ) on client
ex.> promprt>dnf install openssh-client
4. run ssh client on client
ex> prompt>eval $(ssh-agent -s)
5. Adding environment’s variable SSH_PRIVATE_KEY to the SSH client’s agent that manages the private keys on client
ex> prompt>echo “$SSH_PRIVATE_KEY” | tr -d ‘\r’ | ssh-add –
6. Create the SSH directory and give it the right permissions on client
ex> prompt> mkdir -p ~/.ssh
prompt> chmod 700 ~/.ssh
7. execute remote script via ssh on client
ssh -o StrictHostKeyChecking=no root@stg.sp-kcc.ml “cd /opt/felice && ./re-deploy-felice.sh && /opt/felice-src/reload-openapi.sh”