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

Add ACL example #121

Merged
merged 5 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Userguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ knowledge, tips and tricks and example commands.
.. Nope, not that one, because we'll talk about singularity instead.
.. include:: Userguide_containers.rst
.. include:: Userguide_singularity.rst
.. include:: Userguide_sharing_data.rst
.. include:: Userguide_datasets.rst
.. include:: Userguide_data_transfer.rst
.. include:: Userguide_jupyterhub.rst
Expand Down
101 changes: 101 additions & 0 deletions docs/Userguide_sharing_data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Sharing Data with ACLs
======================
btravouillon marked this conversation as resolved.
Show resolved Hide resolved

As an illustrative example, to allow ``$USER`` to share with ``$USER2`` in
``rwx`` a hierarchy ``/network/scratch/$USER/X/Y/Z/...`` with ACLs:
obilaniu marked this conversation as resolved.
Show resolved Hide resolved

----

| Grant **oneself** permissions to access any **future** files/folders created
by the other *(or oneself)*
btravouillon marked this conversation as resolved.
Show resolved Hide resolved
| (``-d`` renders this permission a "default" / inheritable one)

.. code-block:: bash

setfacl -Rdm user:$USER:rwx /network/scratch/$USER/X/Y/Z/
btravouillon marked this conversation as resolved.
Show resolved Hide resolved

----

| Grant **another** permission to access any **future** files/folders created
by the other *(or oneself)*
| (``-d`` renders this permission a "default" / inheritable one)

.. code-block:: bash

setfacl -Rdm user:$USER2:rwx /network/scratch/$USER/X/Y/Z/

----

| Grant **another** permission to access any **existing** files/folders created
obilaniu marked this conversation as resolved.
Show resolved Hide resolved
by *oneself*.
| Such files and folders were created before the new default ACLs were added
above and thus did not inherit them from their parent folder at the moment of
their creation.

.. code-block:: bash

setfacl -Rm user:$USER2:rwx /network/scratch/$USER/X/Y/Z/

----

| Grant **another** permission to search through one's hierarchy down to the
shared location in question.
btravouillon marked this conversation as resolved.
Show resolved Hide resolved

* **Non**-recursive (!!!!)
* May also grant ``:rx`` in unlikely event others listing your folders on the
path is not troublesome or desirable.

----

| In order to access a file, all folders from the root (``/``) down to the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this part of the previous section on "searching"? It looks like it's its own different example, but the content seems like it's part of the previous block

parent folder in question must be searchable (``+x``) by the concerned user.
This is already the case for all users for folders such as ``/``, ``/network``
and ``/network/scratch``, but users must explicitly grant access to some or
all users by adding ACLs for ``/network/scratch/$USER``, ``$HOME`` and
subfolders.

.. code-block:: bash

setfacl -m user:$USER2:x /network/scratch/$USER/X/Y/
setfacl -m user:$USER2:x /network/scratch/$USER/X/
setfacl -m user:$USER2:x /network/scratch/$USER/
btravouillon marked this conversation as resolved.
Show resolved Hide resolved

----

| To bluntly allow **all** users to search through a folder (**think twice!**),
obilaniu marked this conversation as resolved.
Show resolved Hide resolved
the following command can be used:

.. code-block:: bash

chmod a+x /network/scratch/$USER/

----

.. note::
* ``man setfacl``
* ``man path_resolution``

Viewing and Verifying ACLs
--------------------------

.. code-block:: bash

getfacl /path/to/folder/or/file
1: # file: somedir/
2: # owner: lisa
3: # group: staff
4: # flags: -s-
5: user::rwx
6: user:joe:rwx #effective:r-x
7: group::rwx #effective:r-x
8: group:cool:r-x
9: mask::r-x
10: other::r-x
11: default:user::rwx
12: default:user:joe:rwx #effective:r-x
13: default:group::r-x
14: default:mask::r-x
15: default:other::---

.. note::
* ``man getfacl``