acl.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1841 2aaf1f0297f9
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1841
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
.. include:: HEADER.rst
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
======
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 ACL.
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
======
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
.. contents::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Managing ACL permissions.
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
=========================
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
Set permission::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ sudo setfacl -m u:nobody:rwx ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  $ sudo setfacl -m g:nogroup:rwx ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
Review permissions::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
  $ sudo getfacl ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
Remove specific permissions::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  $ sudo setfacl -x u:test ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
Remove all ACL permissions::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
  $ sudo setfacl -b ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
Remove default ACL::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
  $ sudo setfacl -k ~/tmp/dir
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
Backup and restore ACL::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
  $ sudo getfacl ~/tmp/dir >~/tmp/backup.acl
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  $ sudo setfacl --restore=~/tmp/backup.acl
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
Add default ACL to directory to make ACL permission inheritance::
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  $ sudo setfacl -m -d u:nobody:rwx /srv/www
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
  $ sudo setfacl -m u:nobody:rwx /srv/www
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
.. NOTE:: default ACL is set only on directories and is applied only to
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
          directory children. So you should explicitly add permission to
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
          directory itself!
2aaf1f0297f9 Managing ACL permissions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46