Skip to content

Creating gpg key file doesn't work in user is not root #30

Description

@jimmykarily

Here: https://github.com/docker-practice/actions-setup-docker/blob/fd7ecdac7caf8e2c541a48c9bcc280aae59a8461/lib/setup-docker.js#LL290C91-L290C91

The last sudo makes sure cat is run with root privileges but not the redirection of the output >. Reproduce:

(run as non-root user)

$ sudo echo "test" >/usr/share/keyrings/docker-archive-keyring.gpg 
bash: /usr/share/keyrings/docker-archive-keyring.gpg: Permission denied

# but this works
sudo sh -c 'echo "test" >/usr/share/keyrings/docker-archive-keyring.gpg'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions