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

Directory "others" execute permissions #300

Closed
ghost opened this issue Dec 19, 2017 · 20 comments
Closed

Directory "others" execute permissions #300

ghost opened this issue Dec 19, 2017 · 20 comments
Assignees

Comments

@ghost
Copy link

ghost commented Dec 19, 2017

Hi,

first of all, great app.

But as always there is a "but". I need to create directories but the group "other" haven't the "execution" permission. Can it be modified in the configuration, or edited in the permission of a directory/file?

Thanks
Brian

@hacdias
Copy link
Member

hacdias commented Dec 27, 2017

Sorry, I didn't quite understand. Do you want to create directories, but the user which is running filemanager isn't allowed to?

@tokvv
Copy link
Contributor

tokvv commented Jan 15, 2018

The permissions of the newly created directory (test) in filemanager is 754 (drwxr-xr--). As a result, we can not run cd test user other than root in terminal (Permission denied).
We need to have permissions 755 (drwxr-xr-x) after the directory creation.

@eroak
Copy link

eroak commented Jan 15, 2018

+1 Same problem here

@hacdias
Copy link
Member

hacdias commented Jan 15, 2018

That's strange. I have set it to create directories with 776 (source). Are you sure the user that runs filemanager has the correct permissions?

@tokvv
Copy link
Contributor

tokvv commented Jan 15, 2018

Yes, I'm sure.
I launch it in Docker.

@eroak
Copy link

eroak commented Jan 15, 2018

Me too. Issue on docker too

@hacdias hacdias self-assigned this Jan 17, 2018
@Equim-chan Equim-chan self-assigned this Feb 5, 2018
@Equim-chan
Copy link
Member

Equim-chan commented Feb 5, 2018

@hacdias I've done some investigation and realized that it is exactly how mkdir expects to work under *nix systems. A bare mkdir call is limited by umask. With a umask value of 0022, new directories will be created with permissions 0755 at most. New files will have permissions 0644 at most.

There are several ways to fix it

  • Call syscall.Umask on init, and change all mkdir's permission into 0777. The downside is that if filebrowser is running as a plugin then it may cause something bad to the host.
  • Call os.Chmod immediately after calling os.Mkdir.

Plus, I think it should be an option for users to choose desired fmask and dmask value.

Ref: golang/go#15210

@hacdias
Copy link
Member

hacdias commented Feb 5, 2018

@Equim-chan thanks for searching about that. What about setting umask with 0755?

@Equim-chan
Copy link
Member

Equim-chan commented Feb 5, 2018

I think the option should leave to the users, while 0755 can be a default value (for dmask).

I myself have met a scene to customize the permission. Since the user/group running filebrowser is different from my own user/group, I add my personal user to the group, expecting files/directories created by filebrowser to be writable from the group.

Also it's better to separate fmask and dmask. The default fmask value can be 0644.

Plus, os.Chmod is better than syscall.Umask since the latter one is platform specific and is likely to cause more problems.

@hacdias
Copy link
Member

hacdias commented Feb 6, 2018

My question about os.Chmod is that if you don't have access to the file due to the permissions, how can you change them?

@Equim-chan
Copy link
Member

If I am able to touch a new file, I must at least have -wx permission on the current dir, then I can of course chmod the file. Am I wrong?

@hacdias
Copy link
Member

hacdias commented Feb 6, 2018

Yeah, I think you're right. Go for it then. Create a new branch and open a PR with a fix 😄

@Equim-chan
Copy link
Member

Equim-chan commented Feb 7, 2018

Hmm, I think the change should be made in github.com/hacdias/fileutils instead.

Also should we really prefer umask over chmod or?

@hacdias
Copy link
Member

hacdias commented Feb 8, 2018

Let's start by trying using chmod to make sure it works. If not, we can then change to umask.

@Equim-chan
Copy link
Member

Okay I'll try, but just a bit busy at the moment.

@TaylorWorthing
Copy link

It would also be nice to have a way to view and set permissions in the UI.

@tokvv
Copy link
Contributor

tokvv commented May 8, 2018

Hi @hacdias, аre there any updates on this issue?
Thank you very much for your work!

@ww7
Copy link

ww7 commented May 21, 2018

Same issue on Centos.
Any workflow for this?

@adminrezo
Copy link

Same issue on Debian.

tokvv added a commit to tokvv/filebrowser-1 that referenced this issue Jun 25, 2018
Fixed this issue. Issue Directory "others" execute permissions filebrowser#300
@nicedreams
Copy link

I'm on Debian and when I create files (ie: *.txt) the permissions are set to 755. I have "other" group and rest of files set to 0700 since running filebrowser as user filebrowser, but files and folders still 755 when created through interface. Would like files 644 or 640 for that matter instead.

hacdias pushed a commit that referenced this issue May 11, 2019
Former-commit-id: 0b0798905c957972e4deb0a934593f8c06910160 [formerly d77b03128a8c6b28a07998be4a29e3cfa8c14345] [formerly 19c9cefe047c2ef0c43d03d37fc4633bc35fbdb9 [formerly a07b08d]]
Former-commit-id: 72b8c93ab89c5df491899b3e41be46090089b406 [formerly 4a3e4bbac51eb2cc5c2fb75cb6de8ed5da01a108]
Former-commit-id: 86a702dbd2daa2ce36e799f6fd8b2ec8957c6844
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

8 participants