简体   繁体   中英

Not able to add Linux machine as Slave to Jenkins master running on Windows machine

Tried creating ssh key on Windows master and shared pub key to linux slave node. permission on linux slave is 600 for authorized keys. added my private key to jenkins credential as ssh username and private key

I have added Linux slave Ip and hostname to windows machine hosts file and vice versa.

Tried all option in dropdown for verifying the host key. no luck.

Master: Windows. created jenkins local user and ssh key generated with that user. Slave: Linux node. created jenkins user and ssh key copied to jenkins user.

below is the error.

SSHLauncher{host='********', port=22, credentialsId='7-9daf-fe34097adb71', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true} [06/10/21 12:49:53] [SSH] Opening SSH connection to *******. [06/10/21 12:49:53] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed. ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:-4fc7-9daf-fe34097adb71/method:publickey) [06/10/21 12:49:53] [SSH] Authentication failed. Authentication failed. [06/10/21 12:49:53] Launch failed - cleaning up connection [06/10/21 12:49:53] [SSH] Connection closed.

There are a few different permissions that might be at work here, on the Linux side. You need to check the permissions on ~/.ssh/authorized_keys and ~/.ssh , which you have partly done already. Additionally, there may be SELinux labelling preventing access. Try the following:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
restorecon -Rv ~/.ssh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM