Hi all,

I am trying to use Jenkins Remote CLI to configure my Jenkins server 
remotely. I am running a jenkinsci/blueocean docker container. 

To enabled SSHD on my jenkins server:
1) At http://localhost:8080/configureSecurity/ : Enabled SSHD Port -> Random
2) AT http://localhost:8080/user/baymac/configure: Added my Public key of 
local machine

Trying ssh from bash:
ssh -l baymac -p 46653 localhost who-am-i

Error message:
ssh: connect to host localhost port 46653: Connection refused

Trying to use Jenkins CLI client to ssh into Jenkins server with the 
following command:

java -jar jenkins-cli.jar -s http://localhost:8080 -i ~/.ssh/id_rsa -ssh 
-user baymac who-am-i

I receive an error message:
Enter passphrase for /home/parichay/.ssh/id_rsa:
Mar 24, 2019 6:38:56 AM 
org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver 
reloadHostConfigEntries
INFO: resolveEffectiveResolver(baymac@localhost:46653) loaded 1 entries 
from /home/parichay/.ssh/config
org.apache.sshd.common.RuntimeSshException: Failed to get the session.
at 
org.apache.sshd.client.future.DefaultConnectFuture.getSession(DefaultConnectFuture.java:59)
at hudson.cli.SSHCLI.sshConnection(SSHCLI.java:104)
at hudson.cli.CLI._main(CLI.java:608)
at hudson.cli.CLI.main(CLI.java:427)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method)
at 
sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252)
at 
sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
at 
sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:293)
at java.lang.Thread.run(Thread.java:748)

I enter the right passphrase, since I tried to ssh into another device it 
is working.

Extra information:

I run the docker with the following command:

sudo docker run \ 

  --rm \ 

  -u root \ 

  -p 8080:8080 \ 

  -v jenkins-data:/var/jenkins_home \ 

  -v /var/run/docker.sock:/var/run/docker.sock \ 

  -v "$HOME":/home \ 

  --name jenkins \ 

  Jenkinsci/blueocean 

HTTP auth works:

java -jar jenkins-cli.jar -s http://localhost:8080/ -auth baymac:<api_token> 
who-am-i


Message: 

Authenticated as: baymac
Authorities:
  authenticated


I am unable to debug this, a pointer to this error would be really helpful.

Regards,
Parichay (baymac)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/53f15502-cf94-4a51-9202-7f0080e45c05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to