sftp icon indicating copy to clipboard operation
sftp copied to clipboard

atmoz/sftp + Testcontainers - Permission denied

Open mklueh opened this issue 3 years ago • 6 comments

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 :)

mklueh avatar Apr 20 '21 11:04 mklueh

Thank you for your post, @mklueh :+1: This helped at least one person!

akulik512 avatar Apr 28 '21 08:04 akulik512

@mklueh is it possible to post your solution as a Dockerfile, rather than Java code? Thanks so much!

tommyjcarpenter avatar Apr 28 '21 13:04 tommyjcarpenter

@tommyjcarpenter I´ve added it to the article quickly, but no time for testing currently. Feel free to give feedback :)

mklueh avatar Apr 28 '21 14:04 mklueh

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 :)

derklaro avatar Mar 20 '22 16:03 derklaro

None of the solutions mentioned above worked for me

bkeren avatar Sep 22 '22 11:09 bkeren

See https://github.com/testcontainers/testcontainers-java/issues/6316#issuecomment-1362438260

eddumelendez avatar Dec 22 '22 06:12 eddumelendez