Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Another way is to put the apache user and the "customer users" in a new group. Additional the directory should use the sticky bit <code>SGID</code> so each new file got the group assignment to this new group. This way the webserver and the "customer users" can work with the files without any problems</p> <pre><code>[17:57] progman@proglap /tmp/test $ ls -al /tmp/test total 9 drwxrwsr-x 2 root users 48 Apr 1 17:55 . drwxrwxrwt 36 root root 9264 Apr 1 17:53 .. </code></pre> <p>As you see the directory got the stick bit <code>SGID</code> and the owner is the "users" group in which I (<code>progman</code>) am. No if another user adds a file the group automatically get set to this group</p> <pre><code>[17:55] proglap ~ # touch /tmp/test/x </code></pre> <p>This is executed from root. Now we get:</p> <pre><code>[17:57] progman@proglap /tmp/test $ ls -la /tmp/test total 9 drwxrwsr-x 2 root users 72 Apr 1 17:59 . drwxrwxrwt 36 root root 9264 Apr 1 17:53 .. -rw-r--r-- 1 root users 0 Apr 1 17:59 x </code></pre> <p>As you see the added file is from root, but the group is set to <code>users</code> and this way <strong>I</strong> can remove it</p> <pre><code>[18:00] progman@proglap /tmp/test $ rm x rm: remove write-protected regular empty file `x'? y [18:01] progman@proglap /tmp/test $ ls -la /tmp/test total 9 drwxrwsr-x 2 root users 48 Apr 1 18:01 . drwxrwxrwt 36 root root 9264 Apr 1 17:53 .. </code></pre> <p>Keep in mind that you still need to change the <code>chmod</code> if you want to <em>edit</em> the file as <code>rw-r--r--</code> is just <em>group read access</em>. But changing the <code>chmod</code>, maybe even working with <code>umask</code>, is better than dealing with root-access and using <code>chown</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload