Create private user folders, preventing other users from reading user folder contents. #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposal
Make user folders private. This prevents other FTP users and groups from reading the contents of each user's FTP folder.
Note about Parent Directories
This does not prevent an FTP user from going up a directory however, so only partially helps the issue that FTP users can go up to the parent directory and view the names of other user folders.
By removing the read permission bit from all users on the parent directory, FTP users can be prevented from seeing the contents of the parent directory. For example.
If we have two user folders:
$ ls -al /ftp total 0 drwxr-x--x 1 root root 34 Mar 31 09:45 . drwxr-xr-x 1 root root 6 Mar 30 06:43 .. drwxr-s--- 1 user1 user1 16 Mar 31 09:50 user1 drwxr-s--- 1 user2 user2 0 Mar 31 09:45 user2
Note the
r
bit is missing from/ftp
. This is applied with:It is a bit tricky to add this to the
start_vsftpd.sh
script, as user folders aren't necessarily saved in the same parent directory, as completely separate directories can be configured in theUSERS
environment variable when starting the container. Therefore, I suggest that is left as an exercise for the user, should they want to keep the names of other users and their folders private.