Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Why does my pipeline can't connect to a remote host via SSH?

Hey guys, 
since two days im now searching for any solution for my issue.
I'm trying to connect from the CD pipeline to the remote host via ssh to deploy a new package but the connection does not work properly. 
I created a public/private key pair, without passphrase, and pasted the public key to the authorized_keys on the remote host. I also checked connecting from my local PC to the host via the same keys and it worked.  Could someone help me to get it working or give me some hints to find the problem?

Thanks a lot an advance.

My Pipeline.yml:

image: atlassian/default-image:2
pipelines:
default:
- step:
script:
- ssh -v rbaptista@xxx.xxx.xxx.xxx
- echo "It works!"

Here is the error output from my pipeline:

The "xxx.xxx.xxx.xxx" is just my edited IP address. 

 

Bildschirmfoto 2020-08-05 um 14.36.51.png

As you can see it tells me "Authenticated with partial success.". Does anyone of you knows this error?

best regards,

Rodrigo

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Rodrigo Baptista ,

it's a good case to use ssh-run pipe, where all stuff related to ssh connection from the Bitbucket Pipelines simplified for you.

script:
  - pipe: atlassian/ssh-run:0.2.6
    variables:
      SSH_USER: 'rbaptista'
      SERVER: 'xxx.xxx.xxx.xxx'
      COMMAND: 'echo $HOSTNAME'

More advanced examples you can find in the ssh-run pipe's Readme.

Note! If you want to use the default behaviour for using the configured SSH key and known hosts file, you must have configured the SSH private key and known_hosts to be used for the This pipe in your Pipelines settings (see docs).

It'd be nice if you provide us with feedback about your case!

Hi @Oleksandr Kyrdan,

thanks for your help.
The method you showed helped me out.

best regards, 


Rodrigo 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

422 views 13 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you