Cannot Connect to Jenkins Slave using root user

AJN

I have a Jenkins master in the Windows server and using TFS as source control. I have connected few windows slave servers and a Linux slave server from my Jenkins master. When I try to configure Linux slave using "Launch slave agents on Unix machines via SSH"with root user, it fails to connect by throwing the below errors.

[SSH] Opening SSH connection to xxxxxx.
ERROR: Failed to authenticate as root. Wrong password. (credentialId:98262412-0d53-4f25-92de-beaa8458f459/method:password)
[08/21/15 04:01:43] [SSH] Authentication failed.
hudson.AbortException: Authentication failed.
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1178)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:701)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
[08/21/15 04:01:43] Launch failed - cleaning up connection
[08/21/15 04:01:43] [SSH] Connection closed.

The password is correct since I can login to the slave server manually using the same password as root user. So I tried creating another user named "slave".

Now Jenkins was able to connect to the slave server by using user slave. But while executing job I am running a shell script which we use to run manually but for the sake of CI it should be run from Jenkins, this script has some chown command which are failing with "Permission denied" error, which is obvious since I suppose root user can only run chown command.

So I edited /etc/passwd with slave:x:0:0:: to have root permissions. But know the job fails with the error

Error: You must accept the End User License Agreement for this product
Run 'tf eula' to accept the End User License Agreement.
FATAL: Executable returned an unexpected result code [100]
ERROR: null

I have already accepted user agreement for slave user and as well as root user but still getting this error.

If I rollback the /etc/passwd script to run as slave user this error is gone but again I cant run chown command.

Any help to resolve this will be appreciated, either I be able to connect to slave using root user or slave user should execute chown command.

VDR

You have two options, either you have to enable root ssh access(not recommended) or add your "slave" user to sudoers group and run chown command with sudo (eg: sudo chown /path/to/file.txt).

1) To enable root ssh access, edit /etc/ssh/sshd_config, and comment out the following line:

PermitRootLogin without-password

Just below it, add the following line:

PermitRootLogin yes

Then restart SSH: service ssh restart

2) To add a user to sudoers group, follow instructions as per this link: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/2/html/Getting_Started_Guide/ch02s03.html

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

root cannot connect to symlinked socket of other user

From Dev

Can jenkins slave connect to multiple servers?

From Dev

Jenkins slave using an ssh gateway

From Dev

Jenkins Root User permission as root user

From Dev

Jenkins SSH User with Passphrase on Windows Slave

From Dev

Jenkins Slave using JNLP requires security prompt

From Dev

Jenkins Slave using JNLP requires security prompt

From Dev

Jenkins cannot connect to android emulator

From Dev

Jenkins: dynamically connect slave to master without knowing node secret

From Dev

Jenkins: dynamically connect slave to master without knowing node secret

From Dev

Can't connect using ssh after enabling it on Kali Linux using the root user and password

From Dev

How to specify default user for Jenkins (linux) to Windows slave

From Dev

Cannot connect to instance with new user

From Dev

Run shell command in jenkins as root user?

From Dev

What is the diffrence between user root and jenkins?

From Dev

Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES)

From Dev

Jenkins cannot connect to SonarQube server using HTTPS (HTTP + SSL) with self-signed certificate

From Java

Connect to docker container as user other than root

From Dev

Could not connect: Access denied for user 'root'@'localhost'

From Dev

NGinX cannot connect to Jenkins on CentOS 7

From Dev

Access files on a node slave from Jenkins master using Groovy

From Dev

Automating TestStack.White UI Testing in Windows Slave using Jenkins

From Dev

Cannot set password for MySQL root user

From Dev

LFS 8.2, cannot change user to root

From Dev

Cannot edit crontab as non root user

From Dev

Cannot connect to database using sqlsrv_connect()

From Dev

Jenkins Slave Prints message Cannot contact slave-host: java.io.IOException: Remote call on Channel to /10.0.2.2 failed

From Dev

Cannot switch to jenkins user redhat linux

From Dev

Jenkins slave configuration

Related Related

  1. 1

    root cannot connect to symlinked socket of other user

  2. 2

    Can jenkins slave connect to multiple servers?

  3. 3

    Jenkins slave using an ssh gateway

  4. 4

    Jenkins Root User permission as root user

  5. 5

    Jenkins SSH User with Passphrase on Windows Slave

  6. 6

    Jenkins Slave using JNLP requires security prompt

  7. 7

    Jenkins Slave using JNLP requires security prompt

  8. 8

    Jenkins cannot connect to android emulator

  9. 9

    Jenkins: dynamically connect slave to master without knowing node secret

  10. 10

    Jenkins: dynamically connect slave to master without knowing node secret

  11. 11

    Can't connect using ssh after enabling it on Kali Linux using the root user and password

  12. 12

    How to specify default user for Jenkins (linux) to Windows slave

  13. 13

    Cannot connect to instance with new user

  14. 14

    Run shell command in jenkins as root user?

  15. 15

    What is the diffrence between user root and jenkins?

  16. 16

    Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES)

  17. 17

    Jenkins cannot connect to SonarQube server using HTTPS (HTTP + SSL) with self-signed certificate

  18. 18

    Connect to docker container as user other than root

  19. 19

    Could not connect: Access denied for user 'root'@'localhost'

  20. 20

    NGinX cannot connect to Jenkins on CentOS 7

  21. 21

    Access files on a node slave from Jenkins master using Groovy

  22. 22

    Automating TestStack.White UI Testing in Windows Slave using Jenkins

  23. 23

    Cannot set password for MySQL root user

  24. 24

    LFS 8.2, cannot change user to root

  25. 25

    Cannot edit crontab as non root user

  26. 26

    Cannot connect to database using sqlsrv_connect()

  27. 27

    Jenkins Slave Prints message Cannot contact slave-host: java.io.IOException: Remote call on Channel to /10.0.2.2 failed

  28. 28

    Cannot switch to jenkins user redhat linux

  29. 29

    Jenkins slave configuration

HotTag

Archive