Skip to content
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

how to prevent ftp user to go to parent directory? #19

Open
mdallau opened this issue Feb 7, 2021 · 8 comments
Open

how to prevent ftp user to go to parent directory? #19

mdallau opened this issue Feb 7, 2021 · 8 comments

Comments

@mdallau
Copy link

mdallau commented Feb 7, 2021

I noticed that when I connect to the ftp-server I am able to go to the parent directory and even to other directories in the root.
How can I prevent the ftp user to go other directories?

@gadget1999
Copy link

add the following lines to vsftpd.conf:

chroot_local_user=YES
allow_writeable_chroot=YES

@TrueOsiris
Copy link
Contributor

This is now in the default file.

@delfer
Copy link
Owner

delfer commented Mar 23, 2021

Reverted #22

@albanm
Copy link

albanm commented Mar 9, 2022

How is it possible to get this functionality since the commit was reverted ?

@Jormodn
Copy link

Jormodn commented Jun 21, 2022

Any feature plans to get that feature after that revert?

@G3z
Copy link

G3z commented Jul 6, 2022

to use this options:

  • I created a vsftpd.conf file with the content taken from the repo
  • uncommented chroot_local_user=YES and added allow_writeable_chroot=YES just below it
  • set root:root as owner and group of the file (otherwise ftp server did not respond)
  • mounted the file inside the container - "./vsftpd/vsftpd.conf:/etc/vsftpd/vsftpd.conf"

@ShubhTakale
Copy link

I noticed that when I connect to the ftp-server I am able to go to the parent directory and even to other directories in the root. How can I prevent the ftp user to go other directories?

How are you connecting, I am not able to connect?

@alexleach
Copy link

alexleach commented Mar 31, 2024

Personally I changed the folder permissions:

In docker-compose.yaml:

version: "3.0"

services:
  ftp:
    image: delfer/alpine-ftp-server
    environment:
      - USERS=user1|password1|/srv/ftp/user1 user2|password2|/srv/ftp/user2
    volumes:
      - /srv/ftp:/srv/ftp
[...]

Bring the container up, and let the container make the user folders.

Then in the host, remove global read permissions from /srv/ftp, and read and execute permissions from /srv/ftp/*:

$ sudo chmod o-r /srv/ftp
$ sudo chmod o-rx /srv/ftp/*

I think this could quite easily be put into the startup script, I'll see about creating a pull request...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants