Not Authenticating User On Production Server

Hi,

I have an issue where one of my steps is requesting the root password:

#!/bin/bash -eo pipefail
ssh -T $DROPLET_USER@$DROPLET_IP < bin/deploy/pre_deploy.sh
root@xxx.xxx.xxx.xxx's password: 
Too long with no output (exceeded 10m0s)

I have created an SSH key pair on my local machine which I use to connect to my production server, and I have copied the private key to CircleCI > Project Settings > SSH Permissions.

Here is my config file, thanks in advance for any advice you can offer.

version: 2
jobs:
  build:
    working_directory: ~/my-project
    docker:
      - image: circleci/php:7.2.4-apache-stretch-node-browsers
        environment:
          APP_ENV: test
          DATABASE_URL: mysql://root:root@127.0.0.1/my-project
          MAILER_URL: null://localhost
          SENDER_ADDRESS: notifications@my-project.com

      - image: circleci/mysql:5.7
        environment:
          MYSQL_ROOT_PASSWORD: 'root'
          MYSQL_DATABASE: 'my-project_test'
    steps:
      - checkout
      - run:
          name: Install apt
          command: sudo apt-get install -y zlib1g-dev
      - run:
          name: Install PHP & MySQL
          command: sudo docker-php-ext-install pdo_mysql zip
      - run:
          name: Wait for MySQL
          command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
      - run:
          name: Composer
          command: sudo composer self-update
      - run:
          name: Composer install
          command: composer install -n --prefer-dist
      - run:
          name: Update Schema
          command: bin/console doctrine:schema:update --force --env=test --no-interaction
      - run:
          name: Generate JWT keys
          command: ./bin/jwt_keys/generate.sh
          environment:
            JWT_PASSPHRASE: password
      - run:
          name: Run tests
          command: ./bin/phpunit
  deploy:
    working_directory: ~/my-project
    docker:
      - image: circleci/php:7.2.4-apache-stretch-node-browsers
    steps:
      - checkout
      - run:
          name: Composer install
          command: composer install -n --prefer-dist
      - run:
          name: Clear cache
          command: php bin/console cache:clear --env=prod --no-interaction
      - run:
          name: Clear warmup
          command: php bin/console cache:warmup --env=prod --no-interaction
      - run:
          name: Yarn
          command: yarn install && yarn run encore production
      - run:
          name: Add droplet
          command: ssh-keyscan -H $DROPLET_IP > ~/.ssh/known_hosts
      - run:
          name: Pre deploy
          command: ssh -T $DROPLET_USER@$DROPLET_IP < bin/deploy/pre_deploy.sh
      - run:
          name: Deploy code
          command: rsync -vzcrSLhp --exclude '.env' --delete ~/my-project/ $DROPLET_USER@$DROPLET_IP:/var/www/my-project-current
      - run:
          name: Post deploy
          command: ssh -T $DROPLET_USER@$DROPLET_IP < bin/deploy/deploy.sh
workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

I wonder if redirecting a password in a text file does not work with the SSH command. If that is the case, try the expect command. It can be used to make arbitrary commands run in a headless fashion.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.