Comments (3)
In order to double check I have been having a look at the different points where directories are created, and as I was remembering no one of the os.makedirs
calls explicitly set the directory permissions. So, the permissions used before applying the umask for the directory creation are the default ones, described at https://docs.python.org/3/library/os.html#os.makedirs
So, my guess is that the initial umask inherited by the process calling WfExS is what it can be troublesome in the first call.
from wfexs-backend.
@jmfernandez, I've done some reading and a little playing around. I think the best thing to do is: in the places where you are calling os.makedirs
, you should explicitly set the mode
parameter using an octal number. e.g. 0o777
for all permissions for everyone, or 0o755
for everything for you and r+x
for everyone else. Or more conservatively 0o644
for r+w
for you and r
only for everyone else. The choice depends on what the directories are used for.
from wfexs-backend.
Hi @dcl10 , the real point there is that umask
is a property from any process, inheriting its initial value from the parent process which forked the program. You can see the effect of the different umask
values using the very same mode of 0o777
:
jmfernandez@pavonis[1]:/tmp> mkdir playground
jmfernandez@pavonis[2]:/tmp> cd playground
jmfernandez@pavonis[3]:/tmp/playground> umask
0022
jmfernandez@pavonis[4]:/tmp/playground> python -c 'import os; os.makedirs("default_mask", mode=0o777)'
jmfernandez@pavonis[5]:/tmp/playground> ls -ld
drwxr-xr-x 1 jmfernandez users 24 ago 25 19:08 .
jmfernandez@pavonis[6]:/tmp/playground> ls -ld *
drwxr-xr-x 1 jmfernandez users 0 ago 25 19:08 default_mask
jmfernandez@pavonis[7]:/tmp/playground> umask 0222
jmfernandez@pavonis[8]:/tmp/playground> umask
0222
jmfernandez@pavonis[9]:/tmp/playground> python -c 'import os; os.makedirs("ro_mask", mode=0o777)'
jmfernandez@pavonis[10]:/tmp/playground> ls -ld *
drwxr-xr-x 1 jmfernandez users 0 ago 25 19:08 default_mask
dr-xr-xr-x 1 jmfernandez users 0 ago 25 19:08 ro_mask
jmfernandez@pavonis[11]:/tmp/playground> umask 0077
jmfernandez@pavonis[12]:/tmp/playground> python -c 'import os; os.makedirs("useronly_mask", mode=0o777)'
jmfernandez@pavonis[13]:/tmp/playground> ls -ld *
drwxr-xr-x 1 jmfernandez users 0 ago 25 19:08 default_mask
dr-xr-xr-x 1 jmfernandez users 0 ago 25 19:08 ro_mask
drwx------ 1 jmfernandez users 0 ago 25 19:09 useronly_mask
jmfernandez@pavonis[14]:/tmp/playground> umask 0777
jmfernandez@pavonis[15]:/tmp/playground> python -c 'import os; os.makedirs("noone_mask", mode=0o777)'
jmfernandez@pavonis[16]:/tmp/playground> ls -ld *
drwxr-xr-x 1 jmfernandez users 0 ago 25 19:08 default_mask
d--------- 1 jmfernandez users 0 ago 25 19:10 noone_mask
dr-xr-xr-x 1 jmfernandez users 0 ago 25 19:08 ro_mask
drwx------ 1 jmfernandez users 0 ago 25 19:09 useronly_mask
The mask from the umask
property is applied by the operating system when a file or directory creation operation is requested from the process. It is done so in order to give control to the user over the default permissions without having to change every program.
Of course, a process is allowed to change its own umask
property value, as you can see:
jmfernandez@pavonis[1]:/tmp> mkdir playground2
jmfernandez@pavonis[2]:/tmp> cd playground2
jmfernandez@pavonis[3]:/tmp/playground2> umask
0022
jmfernandez@pavonis[4]:/tmp/playground2> umask 0777
jmfernandez@pavonis[5]:/tmp/playground2> python -c 'import os; os.makedirs("noone_mask", mode=0o777)'
jmfernandez@pavonis[6]:/tmp/playground2> python -c 'import os; os.umask(0o000); os.makedirs("everyone_mask", mode=0o777)'
jmfernandez@pavonis[7]:/tmp/playground2> ls -ld *
drwxrwxrwx 1 jmfernandez users 0 ago 25 19:23 everyone_mask
d--------- 1 jmfernandez users 0 ago 25 19:23 noone_mask
Typical programs changing its umask
are shells (like bash), daemons and services. Outside these scenarios, it is considered an antipattern that a program changes its own umask
, as then the user cannot tweak the permissions through the initially inherited umask
.
So, my recommendation is that the umask
should be adjusted just before WfExS-backend is run. For instance to something like umask 0077
or umask 0027
, depending on whether you trust the default group of the user.
from wfexs-backend.
Related Issues (20)
- Add support for compact `drs` identifiers HOT 1
- Add support for `secondaryFiles` CWL HOT 3
- Add support to `dav` and `davs` schemes
- Cannot download content from ftp HOT 5
- TypeError: Multiple inheritance with NamedTuple is not supported HOT 3
- Parsing of Nextflow DSL2 workflows HOT 1
- Add support for swh permanent identifiers HOT 1
- Add several checks in the code to detect containers unavailable for the current hardware architecture
- Consider supporting other processor architectures through multiarch/qemu-user-static HOT 1
- Use pyinvoke and Fabric
- Fix dependency on newer versions of python-dxf HOT 1
- Introduce codemeta.json
- Secrets/secret inputs HOT 2
- Allow using as a staging source a Workflow Run RO-Crate
- Bug in path resolution in local config file HOT 3
- Error while running WfExS using a local workflow file/directory HOT 7
- Can't execute workflows using podman HOT 3
- `dot` dependency should be optional
- WfExS-backend init issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wfexs-backend.