Error using scp to transfer files to CentOS

19 views
Skip to first unread message

Thiago Carvalho Davila

unread,
Apr 18, 2017, 8:38:21 AM4/18/17
to jenkins...@googlegroups.com
Hello,

I'm having trouble to transfer files via scp to my CentOS servers. I generated RSA keys on destination servers:

ssh-keygen -t rsa

And added to known_hosts in my jenkins slave:

ssh-keyscan -t rsa ${HOST_IP} >> ~/.ssh/known_hosts

Then I made a job to transfer files and I am getting the error:
+ scp /opt/programas/jenkins/tmp/file.jar ro...@10.139.5.166:/opt/websites/jboss/6.3-eap/file.jar
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
lost connection

Any thoughts?

Best regards,

Thiago
-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

Dirk Heinrichs

unread,
Apr 18, 2017, 8:53:58 AM4/18/17
to jenkins...@googlegroups.com
Am 18.04.2017 um 14:38 schrieb Thiago Carvalho Davila:

I'm having trouble to transfer files via scp to my CentOS servers. I generated RSA keys on destination servers:

ssh-keygen -t rsa

And added to known_hosts in my jenkins slave:

ssh-keyscan -t rsa ${HOST_IP} >> ~/.ssh/known_hosts


So now the slave knows your destination server, that's good.


Then I made a job to transfer files and I am getting the error:
+ scp /opt/programas/jenkins/tmp/file.jar ro...@10.139.5.166:/opt/websites/jboss/6.3-eap/file.jar
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
lost connection

But obviously, the root user at the destination server doesn't know your jenkins user. You need to provide a user keyfile so that the user can authenticate to the server. You can do that with the same command as above, but on your slave and as the user running the slave process, then copy the key over:

ssh-copy-id ro...@10.139.5.166

HTH...

    Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenTextTM Discovery | Recommind
Email: dirk.he...@recommind.com
Website: www.recommind.de

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

Thiago Carvalho Davila

unread,
Apr 18, 2017, 2:00:26 PM4/18/17
to jenkins...@googlegroups.com
That worked! Thanks a lot.

Best regards.

Thiago
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d6f9dc43-a5e3-8799-0fbc-014581d3c742%40opentext.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages