- Newest
- Most votes
- Most comments
You need to login to the worker node (slave) as the user that Jenkins will connect via SSH. Then cd ~/.ssh and edit or create the authorized_keys file. In this file, place the Public Key for the ssh key that Jenkins will be connecting with.
Once you have done this, you can test the connection for the primary node to the worker.
Background documentation on SSH based auth. https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server
Hope this helps!
Hai AWS team,
sorry to say this
I know how to login a node with ssh username with private key, but I want to know how to create a node with username and password in launch method. when we add credentials to node it got errors like
ERROR MESSAGE:
SSHLauncher{host='172.31.35.194', port=22, credentialsId='1428b6e5-99f2-4e2a-ae28-b2fb098d3ac2', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[07/17/24 10:30:03] [SSH] Opening SSH connection to 172.31.35.194:22.
[07/17/24 10:30:03] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
[07/17/24 10:30:03] [SSH] Authentication failed.
Authentication failed.
[07/17/24 10:30:03] Launch failed - cleaning up connection
[07/17/24 10:30:03] [SSH] Connection closed.
this is my error message
thanks in advance
hi
Verify SSH Credentials:
Double-check the username and private key associated with the "ubuntu" credential in Jenkins. Ensure the private key has the correct permissions (usually 600). You can check with ls -l ~/.ssh/id_rsa (replace id_rsa if your key filename is different) on the slave and adjust permissions with chmod 600 ~/.ssh/id_rsa if needed. Consider using a more secure authentication method like key pairs instead of username/password.
Enable SSH Key Verification:
Highly Recommended: Change the sshHostKeyVerificationStrategy to a more secure option like hudson.plugins.sshslaves.verifiers.KnownHostsFileVerificationStrategy. This verifies the slave's SSH fingerprint against a known_hosts file on the master, ensuring you're connecting to the intended server. If you must stick with non-verification for now (not recommended for production): Be very cautious about potential security risks. Manually verify the slave's SSH fingerprint on the master using ssh-keyscan <slave_ip> and add it to the ~jenkins/.ssh/known_hosts file on the master.
Check Firewall Rules:
Ensure both the master's and slave's security groups allow SSH traffic (port 22) between them.
Test SSH Manually:
Try connecting to the slave from the master using a basic SSH command (e.g., ssh -i ~/.ssh/id_rsa ubuntu@172.31.17.124) to isolate the issue. If this works, the problem likely lies in the Jenkins slave configuration.
Review Jenkins Logs:
Check the Jenkins logs for more detailed error messages that might provide further clues.
https://medium.com/@aika.nazhimidinova/configure-jenkins-agents-4d44d9c17a62
Relevant content
- asked a year ago
- asked 4 years ago
- AWS OFFICIALUpdated a year ago

I would not recommend using password based authentication for SSH.
However, I would start with logging into the worker, and set a password for the user that Jenkins will be connecting with.
Then edit
/etc/ssh/sshd_configand change the line forPasswordAuthentication notoPasswordAuthentication yes.Restart SSH
sudo systemctl restart sshd.serviceand then retry the connection from Jenkins.