Trying to access into my server to deploy my server into it once built

I’m trying to run this config.yml (obviously before the job deploy, is another job with more configs that it pass successfully)

But something wrong I’m doing because I’m getting a confirmation of:

Are you sure you want to continue connecting (yes/no)? Step was canceled

And its quite anoying because it stops the building and I’m wasting time of my plan…

Anyway, the command of $NODE_COMMAND contains a ssh and is when is executed is where Im getting this annoying confirmation. As far as I now, (I have to say that Im new on this), I have to set up a SSH key on CircleCI, that is done. Also, I add the same ssh key into bitbucket.

Also, the step of - add_ssh_key an it’s fingerprints, I don’t know if I need it since I have the ssh-key configured in the same CircleCI…

The command of $LINODE_PSW contains a plain password of the ssh connection previously requested, but I event don’t sure if it will works… once inside, I will have to fill the proper folder and make a git pull and print my user and password. This is my objective but till now, without success.

Any helps are welcome, thanks in advance, jv.

          - image: circleci/node:4.8.2

        working_directory: ~/my-directory


          - add_ssh_keys:
                - "xx:1x:1x:1x:xx:17:x1:x1x:1x:1x:11:xx:59:xx:f3:1x"

          - run:
              name: ssh connection
              command: $LINODE_COMMAND

          - run:
              name: password
              command: $LINODE_PSW

          - run:
              name: test ls?
              command: ls -l

      version: 2
          - build
          - deploy:
                - build
                  only: master

It looks like you’re trying to create an SSH session inside a build, and then supply a password to it in a subsequent command. Unless there is something I am not spotting, this will not work.

You want to (a) use SSH with a private key so that it does not request passwords, and (b) supply the actual command you want to run in the ssh command. See ssh --help to see how to do that.

I believe the unknown host warning has been covered before here - do a search using the magnifying glass.

Thanks for your time. Then, I should keep the add_ssh_keys step but ride of the once I paste the password?

Now I was trying to do the same but via executing one bash script that I created, but if you are saying that should be enough, I will follow your steps and use the magnifying glass to search that(Also did that, but will pay more attention).
Cheers, jv

I’m not familiar with the add_ssh_keys thing, but if that is intended to stop the unknown hosts warning, it apparently did not work!

This is how I have fixed this warning in the past.

You can modify the ssh command to shorten the timeout, so it fails more quickly, and does not waste your build minutes.

1 Like

Apparently I thing I detect the main problem and is (when I’ve tried to build my npm) I get this:

npm ERR! package.json ENOENT: no such file or directory, open ‘/home/circleci/project/package.json’
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can’t find a package.json file in your current directory.

So I start to run commands of ls -a in different places and I don’t fins my files inside…

I’m thinking about… perhaps everything is problem of my -checkout command, I got it commented, but now, and I don’t know why, is failing, showing me this:

Cloning into ‘.’…
Warning: Permanently added the RSA host key for IP address ‘SOME_IP_ADDRESS’ to the list of known hosts.

Permission denied (publickey).

That’s exactly the thing my link will show you how to fix. Did you try it?

In your case you’d need to do a checkout step to fetch the “known hosts” file, so you can copy it into place before doing the ssh command.

1 Like