sftp
sftp copied to clipboard
atmoz/sftp + Testcontainers - Permission denied
I was trying to get this image running with Testcontainers, a JUnit compatible library that allows testing against Dockerized applications, but ran into permission issues and I wasted quite a lot of time to get it finally working.
Just in case someone else is also stuck with it, I wrote a small post about it and I thought I post it here in addition:
https://overflowed.dev/blog/sftp-testing-junit-testcontainers-atmoz-sftp/
I needed to execute custom commands to create the user directory and give the right permissions (007) and I like to ask why it requires other/public permissions set to 7 in order to work? Appreciate any explanation to understand it :)
Thank you for your post, @mklueh :+1: This helped at least one person!
@mklueh is it possible to post your solution as a Dockerfile, rather than Java code? Thanks so much!
@tommyjcarpenter I´ve added it to the article quickly, but no time for testing currently. Feel free to give feedback :)
I actually got it working much easier - just needed to change the base path to "templates" instead of the actual home folder (I think it is possible to get into the home folder in another way, but for now this works nicely):
@Container
private static final GenericContainer<?> SFTP = new GenericContainer<>("atmoz/sftp:latest")
.withExposedPorts(22)
.withCommand("cloud️:secret:::templates");
User: cloud
Password: secret
Base-Directory: templates
Works like a charme for me :)
None of the solutions mentioned above worked for me
See https://github.com/testcontainers/testcontainers-java/issues/6316#issuecomment-1362438260