actions-setup-docker icon indicating copy to clipboard operation
actions-setup-docker copied to clipboard

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

Open jimmykarily opened this issue 1 year ago • 0 comments

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'

jimmykarily avatar Apr 28 '23 08:04 jimmykarily