- I would like to use a native ssh client to connect to my Agents.
- SSH plugin randomly disconnects.
- CloudBees Jenkins Enterprise (CJE)
- CloudBees Jenkins Enterprise - Managed Master (CJE-MM)
- CloudBees Jenkins Team (CJT)
- CloudBees Jenkins Platform - Client Master (CJP-CM)
- CloudBees Jenkins Platform - Operations Center (CJP-OC)
- Jenkins LTS
It is possible to launch the agent via a command in the master and use command line SSH to do that. The tunnel is created via a SSH native command. This is one way to move forward while you diagnose the underlying issue.
Use the following command to launch the Agent, replacing the appropriate environment variables:
ssh -i $PATH_TO_KEY_WITHOUT_PASSPHRASE USER@$HOST "cd $AGENT_HOME_DIR && curl -O http://$JENKINS_URL/jnlpJars/agent.jar && java -jar agent.jar"
You need an RSA key without passphrase and need to add this key as an authorized key on each Agent: (~/.ssh/authorized_keys)
ssh-keygen -t rsa -f $HOME/.ssh/test_rsa
Use this command to add the key to authorized keys in Agent, so that you can access the Agent from Master using that key:
ssh-copy-id -i$HOME/.ssh/test_rsa USER@HOST