'Jenkins launch slave via execution of command on the master + Permission denied (publickey,password)

Trying to start a slave node on Jenkins, I already established a successful password less ssh connection from master to slave but for some reason I get this error each time I try to establish the connection on Jenkins.

ssh [email protected] java -jar slave.jar

The slave.jar is present in the above path, It fails with this error:

 Launching agent

Permission denied, please try again.
Permission denied, please try again.
[email protected]: Permission denied (publickey,password).
ERROR: Unable to launch the agent for slave
java.io.EOFException: unexpected stream termination
    at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:459)
    at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404)
    at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:436)
    at hudson.slaves.CommandLauncher.launch(CommandLauncher.java:165)
    at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Any suggestion to make this work?? 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source