curl not able to write to /tmp directory owned by user
5
votes
2
answers
4397
views
I tried running the script as instructed in https://docs.docker.com/engine/security/rootless/ :
$ curl -fsSL https://get.docker.com/rootless | sh
But the script crashed in the following line:
curl -L -o docker.tgz "$STATIC_RELEASE_URL"
With the message:
Warning: Failed to create the file docker.tgz: Permission denied
curl: (23) Failure writing output to destination
I narrowed down the problem to
curl
trying to write to the tmp
folder created by mktemp -d
, but I don't understand why it fails.
Some context:
$ whoami
thiago
$ uname -a
Linux thiago-acer 5.8.0-55-generic #62~20.04.1-Ubuntu SMP Wed Jun 2 08:55:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ mktemp -d
/tmp/tmp.U1nPTN5dlS
$ cd /tmp/tmp.U1nPTN5dlS
$ ls -la
total 8
drwx------ 2 thiago thiago 4096 Jun 17 18:20 .
drwxrwxrwt 25 root root 4096 Jun 17 18:20 ..
After running the commands above, I tried:
# this fails with the same message as above
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz -O
# this works just fine
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz -o - > docker-20.10.7.tgz
# this also works
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz
The curl -O
command also works if I try it on some other folder, like my home folder.
Any help is appreciated.
Asked by Thiago Barcala
(151 rep)
Jun 17, 2021, 04:26 PM
Last activity: Aug 2, 2025, 03:05 PM
Last activity: Aug 2, 2025, 03:05 PM