-
Notifications
You must be signed in to change notification settings - Fork 834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Permission denied" error when uploading to volume mounted as subdirectory inside user's home directory #37
Comments
I figured out a workaround involving adding a file to
Would this cause problems for anyone if it were added as part of the entrypoint itself? It seems like the subdirs would need to be owned by the user who is connecting in order for uploads to work at all. Right? Am I missing anything? |
See my #16 (comment) for same kind of problems... |
Cool, glad to know I'm not the only one who ran into this. Would be nice if this could be automatically handled in the entrypoint instead of having to add a script to |
Would it be desirable to have a parameter to create a subfolder within the user's home directory? I forked off of atmoz's master branch to pass a user folder parameter. I also added some logic to the entrypoint file which detects if the folder already exists and if so, not create it which would cause the container to fail to start. You can find it under my public github repository 'ashleymichaelwilliams/sftp'. @atmoz What do you think about doing something like this where it gives people the ability to have write permissions without modifying their host's underlying file-system's ownership/permissions. Maybe you can handle this for a configuration file like previously mentioned. Either way, I think it would be much better to not be hassled. Cheers! |
Thanks for bringing this issue up and finding a solution and a workaround. I've now added a directory parameter to the entrypoint/user syntax. I hope this will solve the issue and make the docker image even easier to use. |
Given this
docker-compose.yml
file:I would expect to be able to upload a file to my mounted subdirectory like this:
but it fails with this:
I'm pretty sure the problem is that the directory I'm uploading is owned by
root
(uid 0) and not by the user who's trying to upload (mi
(uid 1000))...Problem statement
My question/problem is: How do I get my
docker-compose up
to start things up so that they work out of the box?I understand how the user's home directory needs to owned by root for the
chroot
jail to work and that you have to make docker mount volumes in separate directories inside the user's home directory.What I don't understand is who the owner of those subdirectories is supposed to be or how you're supposed to get them to be owned by the right person so that things work out of the box.
I know I could mount a host directory as a volume like in the Readme examples and manually change the owner of that host directory.
But,
I want to be able to just give someone a
docker-compose.yml
file (like the one above) and have them be able to justdocker-compose up
(ordocker run
) and immediately be able to start uploading, without any special config on the host. In other words, have it "just work" out of the box. :) Is this possible?I'm hoping this can be fixed or the documentation can be updated to show how this is possible.
Further details
docker volumes are all owned by root. I'm not sure that there's any (safe) way to change that (?)...
Things I've tried: using uid 0 for sftp user
I saw this in the documentation:
So I tried this:
and
/etc/password
showed this (as if it had worked):but I was unable to log in when I did that:
The text was updated successfully, but these errors were encountered: