Uploading empty file: Permission denied #36

Open
opened 2026-01-19 18:28:41 +00:00 by michael · 7 comments
Owner

Originally created by @zurborg on GitHub.

I started transfer.sh in a container with this arguments: --provider=local, --basedir=/data/

When I upload an empty file, I got this error:

HTTP/2 500 
content-type: text/plain; charset=utf-8
server: Transfer.sh HTTP Server
x-content-type-options: nosniff
x-made-with: <3 by DutchCoders
x-served-by: Proudly served by DutchCoders
date: Tue, 06 Feb 2024 20:50:00 GMT
content-length: 49

open /tmp/transfer-4122496938: permission denied

Same message appears in log.

Tested with this command:

curl -sST /dev/null -i http://localhost/null

Image used: dutchcoders/transfer.sh:latest-noroot

Image ID: 4d51e3998a08

Originally created by @zurborg on GitHub. I started transfer.sh in a container with this arguments: `--provider=local`, `--basedir=/data/` When I upload an empty file, I got this error: ```http HTTP/2 500 content-type: text/plain; charset=utf-8 server: Transfer.sh HTTP Server x-content-type-options: nosniff x-made-with: <3 by DutchCoders x-served-by: Proudly served by DutchCoders date: Tue, 06 Feb 2024 20:50:00 GMT content-length: 49 open /tmp/transfer-4122496938: permission denied ``` Same message appears in log. Tested with this command: `curl -sST /dev/null -i http://localhost/null` Image used: `dutchcoders/transfer.sh:latest-noroot` Image ID: `4d51e3998a08`
Author
Owner

@scolandrea commented on GitHub:

I fixed the issues by mapping the volume from host to container.

Example: docker run --publish 8080:8080 --volume "./tmp:/data" dutchcoders/transfer.sh:latest-noroot --provider local --basedir "/data"

@scolandrea commented on GitHub: I fixed the issues by mapping the volume from host to container. Example: `docker run --publish 8080:8080 --volume "./tmp:/data" dutchcoders/transfer.sh:latest-noroot --provider local --basedir "/data"`
Author
Owner

@DrackThor commented on GitHub:

Same problem here - I tried the simple example from the README.md docs:
image ID: 92f2b0b2f3ff

# started the container
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest-noroot --provider local --basedir /tmp/

# tried to upload a random file
curl -v \
--upload-file ./README.md \
https://localhost:8080/README.md

CURL:

curl -v \
--upload-file ./README.md \
http://localhost:8080/README.md
*   Trying [::1]:8080...
* connect to ::1 port 8080 failed: Connection refused
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080
> PUT /README.md HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 6173
>
* We are completely uploaded and fine
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain; charset=utf-8
< Server: Transfer.sh HTTP Server
< X-Content-Type-Options: nosniff
< X-Made-With: <3 by DutchCoders
< X-Served-By: Proudly served by DutchCoders
< Date: Fri, 16 Feb 2024 09:29:59 GMT
< Content-Length: 24
<
Could not save metadata
* Connection #0 to host localhost left intact

Container LOG:

[transfer.sh]2024/02/16 09:29:43 Transfer.sh server started.
using temp folder: /tmp/
using storage provider: local
[transfer.sh]2024/02/16 09:29:43 starting to listen on: :8080
[transfer.sh]2024/02/16 09:29:43 ---------------------------
[transfer.sh]2024/02/16 09:29:59 mkdir /tmp/uYP5HPT8wo: permission denied
[transfer.sh]2024/02/16 09:29:59 172.17.0.1:54290 - - [2024-02-16T09:29:59Z] "PUT /README.md HTTP/1.1" 500  "" "curl/8.4.0"
^C[transfer.sh]2024/02/16 09:30:32 Server stopped.
@DrackThor commented on GitHub: Same problem here - I tried the simple example from the README.md docs: image ID: `92f2b0b2f3ff` ```bash # started the container docker run --publish 8080:8080 dutchcoders/transfer.sh:latest-noroot --provider local --basedir /tmp/ # tried to upload a random file curl -v \ --upload-file ./README.md \ https://localhost:8080/README.md ``` CURL: ```log curl -v \ --upload-file ./README.md \ http://localhost:8080/README.md * Trying [::1]:8080... * connect to ::1 port 8080 failed: Connection refused * Trying 127.0.0.1:8080... * Connected to localhost (127.0.0.1) port 8080 > PUT /README.md HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/8.4.0 > Accept: */* > Content-Length: 6173 > * We are completely uploaded and fine < HTTP/1.1 500 Internal Server Error < Content-Type: text/plain; charset=utf-8 < Server: Transfer.sh HTTP Server < X-Content-Type-Options: nosniff < X-Made-With: <3 by DutchCoders < X-Served-By: Proudly served by DutchCoders < Date: Fri, 16 Feb 2024 09:29:59 GMT < Content-Length: 24 < Could not save metadata * Connection #0 to host localhost left intact ``` Container LOG: ```log [transfer.sh]2024/02/16 09:29:43 Transfer.sh server started. using temp folder: /tmp/ using storage provider: local [transfer.sh]2024/02/16 09:29:43 starting to listen on: :8080 [transfer.sh]2024/02/16 09:29:43 --------------------------- [transfer.sh]2024/02/16 09:29:59 mkdir /tmp/uYP5HPT8wo: permission denied [transfer.sh]2024/02/16 09:29:59 172.17.0.1:54290 - - [2024-02-16T09:29:59Z] "PUT /README.md HTTP/1.1" 500 "" "curl/8.4.0" ^C[transfer.sh]2024/02/16 09:30:32 Server stopped. ```
Author
Owner

@DrackThor commented on GitHub:

I also tried the same thing with the :latest (root) image - this works fine.
So this very much looks like a -noroot image issue

@DrackThor commented on GitHub: I also tried the same thing with the `:latest` (root) image - this works fine. So this very much looks like a `-noroot` image issue
Author
Owner

@paolafrancesca commented on GitHub:

thanks for the report, I'll check on it

@paolafrancesca commented on GitHub: thanks for the report, I'll check on it
Author
Owner

@zurborg commented on GitHub:

I've tried adding /tmp as volume, and now I get this error:

HTTP/2 400 
content-type: text/plain; charset=utf-8
server: Transfer.sh HTTP Server
x-content-type-options: nosniff
x-made-with: <3 by DutchCoders
x-served-by: Proudly served by DutchCoders
date: Sun, 07 Apr 2024 07:11:19 GMT
content-length: 28

Could not upload empty file

Logfile says:

Empty content-length
@zurborg commented on GitHub: I've tried adding `/tmp` as volume, and now I get this error: ```http HTTP/2 400 content-type: text/plain; charset=utf-8 server: Transfer.sh HTTP Server x-content-type-options: nosniff x-made-with: <3 by DutchCoders x-served-by: Proudly served by DutchCoders date: Sun, 07 Apr 2024 07:11:19 GMT content-length: 28 Could not upload empty file ``` Logfile says: ``` Empty content-length ```
Author
Owner

@scolandrea commented on GitHub:

I've tried adding /tmp as volume, and now I get this error:

HTTP/2 400 
content-type: text/plain; charset=utf-8
server: Transfer.sh HTTP Server
x-content-type-options: nosniff
x-made-with: <3 by DutchCoders
x-served-by: Proudly served by DutchCoders
date: Sun, 07 Apr 2024 07:11:19 GMT
content-length: 28

Could not upload empty file

Logfile says:

Empty content-length

If you run as I posted, first, you must create a directory "tmp" in your current directory. My reply is just trying to explain that you need to make sure the directory exists in the container and you have mapped it on the host.

Good luck

@scolandrea commented on GitHub: > I've tried adding `/tmp` as volume, and now I get this error: > > ```httpspec > HTTP/2 400 > content-type: text/plain; charset=utf-8 > server: Transfer.sh HTTP Server > x-content-type-options: nosniff > x-made-with: <3 by DutchCoders > x-served-by: Proudly served by DutchCoders > date: Sun, 07 Apr 2024 07:11:19 GMT > content-length: 28 > > Could not upload empty file > ``` > > Logfile says: > > ``` > Empty content-length > ``` If you run as I posted, first, you must create a directory "tmp" in your current directory. My reply is just trying to explain that you need to make sure the directory exists in the container and you have mapped it on the host. Good luck
Author
Owner

@zurborg commented on GitHub:

I created the directory before and set the uid and gid both to 5000. Permission is 0775. I can upload any non-empty file. Except for empty files I got the mentioned error.

I think this is fine. Sharing empty files is a bit of useless, so this error don't need to be fixed. Besides, with this setup the error code changed from 500 to 400.

@zurborg commented on GitHub: I created the directory before and set the uid and gid both to 5000. Permission is 0775. I can upload any non-empty file. Except for empty files I got the mentioned error. I think this is fine. Sharing empty files is a bit of useless, so this error don't need to be fixed. Besides, with this setup the error code changed from 500 to 400.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#36