Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Errror, tar: can't open '***.tar': Permission denied #160

Open
karimuddin2021 opened this issue Dec 28, 2023 · 4 comments
Open

Getting Errror, tar: can't open '***.tar': Permission denied #160

karimuddin2021 opened this issue Dec 28, 2023 · 4 comments

Comments

@karimuddin2021
Copy link

Getting errors on the master branch. with the same configuration was working fine before latest update 2 days ago. now I change versions appleboy/scp-action@master. to appleboy/scp-action@v0.1.4. and it's working as expected.

- name: Copy Docker image to EC2
  uses: appleboy/scp-action@v0.1.4
  with:
    host: ${{ secrets.INSTANCE_IP }}
    username: ubuntu
    key: ${{ secrets.SSH_PRIVATE_KEY }}
    source: "${{ secrets.DOCKER_REPO_NAME }}.tar"
    target: "/home/ubuntu/${{ secrets.DOCKER_REPO_NAME }}"

Error:

drone-scp version: v1.6.13
tar all files into /tmp/HDySbTIXlV.tar.gz
tar: can't open '***.tar': Permission denied
tar: error exit delayed from previous errors
exit status 1

@grantholle
Copy link

Also experiencing this!

@allania7med11
Copy link

same here even after update version!!

@fivlao
Copy link

fivlao commented Jan 7, 2024

I don't know how good this approach is, but I solved it like this:
add: chmod 664 my-image.tar

Result workflow:

name: build-deploy

on:
  push:
    branches: [ "dev" ]
  pull_request:
    branches: [ "dev" ]

jobs:
  build-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Build Docker image
        run: docker build . -f ./Dockerfile -t my-image:latest-dev

      - name: Save Docker image as tar file
        run: |
          docker save -o my-image.tar my-image:latest-dev
          chmod 664 my-image.tar

      - name: Transfer Docker image to remote server
        uses: appleboy/scp-action@v0.1.7
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          key: ${{ secrets.PRIVATE_KEY }}
          source: "my-image.tar"
          target: "/home/ubuntu"`

@MohssineSERRAJI
Copy link

Hello,

For my case, I tried adding: chmod 664 my-image.tar but it doesn't work for me.
So I tried to check the ownership of the target folder I found that the owner is root I changed it to my username and it worked fine.

Replace username with the name of the user, groupname with the name of the group (if you also want to change the group ownership), and /path/to/folder with the path to the folder whose ownership you want to change.

If you only want to change the user ownership and keep the folder's group unchanged, you can omit the groupname:

sudo chown username /path/to/folder

Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants