jrc16
jrc16

Reputation: 107

Cannot ssh from Jenkins build step

I am trying to ssh into an Ubuntu 16.04 server from a Jenkins build step but get "Permission denied, please try again".

However, i can ssh using the terminal from the Jenkins server to the Ubuntu 16.04 server without an issue.

On the Jenkins server my permissions look correct:

drwx------  2 ubuntu ubuntu     4096 May 11 09:07 .ssh/

-rw-------  1 ubuntu ubuntu 1679 May 11  2018 id_rsa

-rw-r--r--  1 ubuntu ubuntu  392 May 11  2018 id_rsa.pub

On the Ubuntu 16.04 server my permissions look correct:

drwx------  2 ubuntu ubuntu  4096 May 11 11:16 .ssh

-rw-------  1 ubuntu ubuntu  392 May 11 11:16 authorized_keys

Im rather confused as to why the Jenkins build step cannot ssh correctly, am i missing some configuration for the Jenkins build step?

See a screen shot of the Jenkins build step

Thanks.

Upvotes: 0

Views: 1933

Answers (1)

Const
Const

Reputation: 6663

Im rather confused as to why the Jenkins build step cannot ssh correctly

  • because of this:

    -rw-------  1 ubuntu ubuntu 1679 May 11  2018 id_rsa
    

    this means that your ubuntu user can ssh from jenkins server - not your jenkins user. In order for your jenkins user to be able to ssh you either need to configure username/password for it (shell is disabled by default for jenkins user, you can enable it manually) and place credentials in it's .ssh folder, or use Credentials plugin as suggested.

Upvotes: 3

Related Questions