컬은 사용자가 소유한 /tmp 디렉토리에 쓸 수 없습니다.

컬은 사용자가 소유한 /tmp 디렉토리에 쓸 수 없습니다.

지침에 따라 스크립트를 실행해 보았습니다.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에 쓰려고 시도 했지만 실패하는 이유를 이해할 수 없습니다.tmpmktemp -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설명될 수 있습니다 .rootthiago

좋다:

$ ls -ld /usr/bin/curl
-rwsr-xr-x 1 nobody nogroup 260328 Mar 14 16:37 /usr/bin/curl*

curl -o file디렉토리에 대한 쓰기 액세스 권한이 없는 사람 때문에 실패 file하지만 대신 셸에서 파일을 열기 때문에 작동합니다.open()ednobodycurl -o - > filethiagocurl

또 다른 가능한 설명은 일부 apparmor/SELinux 또는 기타 MAC 보안 시스템 curl/tmp.

이 경우 시스템 또는 감사 로그에 더 많은 정보가 포함되어야 합니다.

관련 정보