
指示に従ってスクリプトを実行してみました。https://docs.docker.com/engine/security/rootless/:
$ curl -fsSL https://get.docker.com/rootless | sh
ただし、次の行でスクリプトがクラッシュします。
curl -L -o docker.tgz "$STATIC_RELEASE_URL"
ニュース:
Warning: Failed to create the file docker.tgz: Permission denied
curl: (23) Failure writing output to destination
問題の範囲をで作成したフォルダcurl
に書き込もうとしましたが、失敗する理由を理解できませんでした。tmp
mktemp -d
いくつかの背景:
$ 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 ..
上記のコマンドを実行した後、次のことを試しました。
# 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
curl -O
このコマンドは、私のホームフォルダなどの他のフォルダで試しても機能します。
助けてくれてありがとう。
答え1
どれだけの人に役立つかはわかりませんが、もし他の人にも役立つかと共有します。私にはFailure writing output to destination
エラーがありますが、バグはありませんPermission denied
。
/tmp
私のディレクトリがいっぱいだからです。
$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
tmpfs 7.8G 7.8G 0 100% /tmp
私の/tmp
ディレクトリをきれいにすることで問題は解決しました。
答え2
この動作は、何らかの理由で実行可能ファイルの権限にsetuidビットがあり、他のユーザーが所有している場合にcurl
説明できます。root
thiago
良い:
$ ls -ld /usr/bin/curl
-rwsr-xr-x 1 nobody nogroup 260328 Mar 14 16:37 /usr/bin/curl*
curl -o file
ディレクトリへの書き込みアクセス権を持っていない人のために失敗しますfile
が、代わりにシェルでファイルを開くために機能します。open()ed
nobody
curl -o - > file
thiago
curl
もう一つの可能な説明は、いくつかのapparmor
/ SELinuxまたは他のMACセキュリティシステムcurl
です/tmp
。
この場合、システムまたは監査ログに詳細情報を含める必要があります。