-1

ssh -i ~/home/devops/.ssh/authorized_keys kiran@35.194.42.142 Warning: Identity file /root/home/devops/.ssh/authorized_keys not accessible: No such file or directory. Pseudo-terminal will not be allocated because stdin is not a terminal. Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

my authorized_keys is in the same location, but it will show no such file or directory

my .yml file is

image: node:8.14.0
pipelines:
  default:
    - step:
        script:
          #- echo "Everything is awesome!"
          #- npm install 
          #- echo "Build files"
          #- echo "$(ls -la)"
          #- npm install -g @angular/cli@1.6.4
          #- ng build -prod
          #- cd dist/ 
          #- echo "$(ls -la)"
          - echo "Connect to server"
          - ssh -i ~/home/kiran/.ssh/authorized_keys kiran@35.194.42.142
          - scp -r README.md kiran@35.194.42.142:/home/kiran/temp
tomerpacific
  • 4,704
  • 13
  • 34
  • 52
kiran
  • 21
  • 3

1 Answers1

2

I see a couple things here.

  1. The file ~/home/kiran/.ssh/authorized_keys doesn't exist in the node:8.14.0 Docker image. (This is the main part of the error message - No such file or directory.)
  2. authorized_keys is a list of public keys. ssh -i needs a private key.
  3. authorized_keys is only used to validate incoming connections - if the new connection request is signed by a private key that corresponds to one of the public keys in authorized_keys then the connection is authorized. You cannot use authorized_keys to establish an outgoing connection, and Pipelines here is attempting to establish an outgoing connection.

You'll need to set up the private key in Pipelines and to add its corresponding public key to authorized_keys on the remote system. https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html has some instructions there.

Jim Redmond
  • 4,139
  • 1
  • 14
  • 18