ssh-action icon indicating copy to clipboard operation
ssh-action copied to clipboard

Use password and key at same time

Open aawnu opened this issue 2 years ago • 5 comments

My host requires the use of both password and ssh-key to connect, but this action does not allow it returning the following: 20***/08/16 19:04:14 can't set password and key at the same time

Its used as follows:

name: Migration

on:
  push:
    branches:
      - master

jobs:
  ssh-migration:
    needs: phpunit
    runs-on: ubuntu-latest
    steps:
      - uses: appleboy/[email protected]
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.SSH_USER }}
          password: ${{ secrets.SSH_PASS }}
          port: ${{ secrets.SSH_PORT }}
          key: ${{ secrets.SSH_KEY }}
          script: |
            cd ${{ secrets.SSH_BASE_PATH }}/laravel
            php artisan migrate

aawnu avatar Aug 16 '22 19:08 aawnu

I have the exact same problem. Have been looking for different solutions, but never found one :( Then i came across this project, and hoped it would work, but again with no luck.

Is it going to be supported? It is really annoying that the host requires both, but not much i can do about it

@AlexWestergaard you use simply? ;) Did you find a solution yet?

zploited avatar Sep 01 '22 15:09 zploited

@zploited for simple hosting solutions I use Simply, yes, but mostly Digital Ocean.

I did not find a fix for this action; ended up making a cronjob that checks migrations and composer updates on the go instead.

aawnu avatar Sep 01 '22 17:09 aawnu

ok, I have found another action that could solve it for me:

  • for uploading with sftp: wangyucode/sftp-upload-action
  • for running ssh commands: garygrossgarten/github-action-ssh

both can use both password and private key, and I just deployed to simply with it

zploited avatar Sep 01 '22 17:09 zploited

I don't find anything on arygrossgarten/github-action-ssh

Nevermind, spelling error, I found it garygrossgarten/github-action-ssh

aawnu avatar Sep 01 '22 17:09 aawnu

woops, yes, I missed the g when copying ;) Good you found out

zploited avatar Sep 01 '22 18:09 zploited

What you need to do is to create a new ssh-key without password, I did it like this and it worked!

castilloedwin avatar Oct 08 '22 18:10 castilloedwin

What you need to do is to create a new ssh-key without password, I did it like this and it worked!

That is not really an option when the host/provider requires both.

aawnu avatar Oct 08 '22 18:10 aawnu

You need to create an user that does this task (no password).

castilloedwin avatar Feb 09 '23 03:02 castilloedwin

You need to create an user that does this task (no password).

I am not sure if you are failing to read key words like host and requires and that its not optional.

aawnu avatar Feb 10 '23 16:02 aawnu

Doesn't your host let you to create Linux users? for example I have two users, the first one is to manage the server and the second one for github actions and without set a password to get into, just ssh-key (with limited permissions).

castilloedwin avatar Feb 21 '23 02:02 castilloedwin

Doesn't your host let you to create Linux users? for example I have two users, the first one is to manage the server and the second one for github actions and without set a password to get into, just ssh-key (with limited permissions).

Correct, the host is not a VPS and is a single-user predefined username+password. I can add key through dashboard for ssh - but it still requires both username and password on authentication.

Thus, I need it to support all 3 at once.

aawnu avatar Feb 21 '23 02:02 aawnu

Yeah, I got it, that's the problem because of appleboy cannot type the password (when the terminal prompt shows up) like a human. I had the same problem, for that reason I decided to create a no password new user.

castilloedwin avatar Feb 21 '23 04:02 castilloedwin

I will take a look.

appleboy avatar Feb 28 '23 08:02 appleboy

try v0.1.8 version

    - name: correct password but wrong key
      uses: appleboy/[email protected]
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.PASSWORD }}
        key: "1234"
        port: ${{ secrets.PORT }}
        script: whoami

    - name: wrong password but correct key
      uses: appleboy/[email protected]
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: "abcdef"
        key: ${{ secrets.KEY }}
        port: ${{ secrets.PORT }}
        script: whoami

appleboy avatar Feb 28 '23 09:02 appleboy