Comments (10)
You have to give the sftp user UID and GID that match file and directory permissions on your mounted volumes.
Say your mounted volume is a directory owned by a user with UID 1000. Then you must set UID to 1000, if you want write permission.
from sftp.
command: foo:pass:::upload
i tried this in docker-compose and it is working without any permission erros.
from sftp.
@atmoz Thanks for the response.
I think I understand but I'm still getting the same permission denied error.
In my docker-compose.yml
i have this:
sftp:
image: atmoz/sftp
volumes:
- "./test/sftp/mock_server:/home/jesse/share"
ports:
- "2222:22"
command: jesse:jesse:502
And locally when I view who owns the directory mock_server
it's my user and when I run id -u
I see that my user's UID is 502.
Can you elaborate or provide any clarification?
Thanks in advance.
from sftp.
What operation are you trying to do? Are you doing it in the "share" directory? What are the permissions on ./test/sftp/mock_server?
Try exec-ing into the container (docker exec -it <container-id> bash
) and create a test-folder and chown it to 502. Can your jesse user change it's content?
from sftp.
@atmoz thanks for the reply. I was able to resolve my issue via the last line of your previous message. Rather than attempting to set the sftp user to the same UID as my local user who owned the share folder, I ssh-ed into the sftp docker container and viewed the info for the folder which was owned by a user with a UID of 1000. So then in the docker-compose.yml
I set my user's UID to 1000 and all worked well. I was able to write and delete files as well as read them.
Thanks for the help.
from sftp.
Is there a way to do this programmatically? I want to deploy my sftp server to a docker swarm. I'd like it if I can just 1) create a key pair for a user 2) create a couple lines in a stack.yml file for the same user and deploy my code and be done. Ideally, I want to have the folders the users' files end up on be a shared aws EFS volume that other services can also mount.
Is there a way to determine UID at dev time, such that I don't have to inspect the folder structure in the container?
Thanks.
from sftp.
This is only slightly related, but after changing the user ID in the config, it's important that one runs:
docker-compose stop
docker-compose up -d
If you do docker-compose restart
, it will not update the config, but instead use the existing container. See the docs for more info.
from sftp.
Is there a way to determine UID at dev time, such that I don't have to inspect the folder structure in the container?
I'd also be interested if anyone has an answer to this
from sftp.
I ended up just mounting my users.conf file as a docker volume. So, I just edit the file at dev time when I want to add a new user.
from sftp.
@atmoz thanks for the reply. I was able to resolve my issue via the last line of your previous message. Rather than attempting to set the sftp user to the same UID as my local user who owned the share folder, I ssh-ed into the sftp docker container and viewed the info for the folder which was owned by a user with a UID of 1000. So then in the
docker-compose.yml
I set my user's UID to 1000 and all worked well. I was able to write and delete files as well as read them.Thanks for the help.
Can you share your docker-compose.yaml file?
from sftp.
Related Issues (20)
- unable to connect no matter what HOT 2
- Does atmoz / sftp support 2 factor authentication with ssh public key and password? HOT 1
- Failed to start the container in AWS code build
- I'm not able to specify the size of the volume HOT 1
- No connection if users binded to UID and GID of the root (0:0) HOT 3
- Support manual homedir HOT 1
- Need help with getting pam-pgsql working HOT 3
- Possibility to disable ChrootDirectory on sshd_config HOT 4
- Create sub directory fail
- curl: (67) Authentication failure
- Container fails to start, exits with code 126 HOT 3
- memory leak on kubernetes HOT 2
- Add support for hpn-ssh HOT 1
- Always use `>>` instead of `>` when appending to a file
- If you are running in k8s and the process stops after authentication with the CPU reaching 100%, add this line to your k8s yaml. HOT 3
- Daily rebuilds triggers restarts via watchtower, even if unnecessary
- Timeouts when connecting HOT 1
- Upgrade Docker Image to Debian Bookworm
- I have created multiple users and can log in. But once I mount the backend NAS's/home, I can't log in. HOT 1
- How to create a Admin user ,Who a see all other directories HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sftp.