mjpclab / go-http-file-server

Simple command line based HTTP file server to share local file system
MIT License
379 stars 55 forks source link

Suggestion: UNauthenticated dirs #39

Open fimmspin opened 6 months ago

fimmspin commented 6 months ago

I have enabled global authentication on / for security. But I need to add some UNauthenticated dirs like for /public dir How is it possible? A setting like --unauth dir1#dir2#dir3 could be nice to override auth requirement :)

marjune163 commented 6 months ago

Then that will be too many negative options like --no-mkdir, --no-upload, etc. I thought about this problem before, but to keep the program simple, I didn't implement all the negative control features.

Is the possible to create 2 alias? One for authenticated user and one for guests?

ghfs --empty-root \
  --alias :/confidential:/fs/path/that/require/auth-access \
  --alias :/public:/fs/path/to/public-access \
  --auth /confidential \
  --user username:password
fimmspin commented 6 months ago

It may be a solution using aliases. thanks!

Another possibility could be (without requiring negative rules you want to avoid): to define an hardcoded 'noauthusr' (noauth, - or the symbol you prefer, so like a 'user' not needing for any auth and not asking for auth in that folder) and then permit it in a rule like this:

--auth-user #/#user1#user2 #/pub#noauthusr #/user3#user3