Sharing data: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 68: Line 68:


<!--T:18-->
<!--T:18-->
If the <tt>setGID</tt> bit is set for a directory, new files and directories in that directory will be created with the same group ownership as the directory. To illustrate the use of this mode, let us walk through an example.
If the <tt>setGID</tt> bit is enabled for a directory, new files and directories in that directory will be created with the same group ownership as the directory. To illustrate the use of this mode, let us walk through an example.


<!--T:17-->
<!--T:17-->
Line 87: Line 87:
-rw-rw-r-- 1 someuser  someuser    0 Oct 13 19:38 test01.txt
-rw-rw-r-- 1 someuser  someuser    0 Oct 13 19:38 test01.txt
</source>
</source>
If we are in <code>/project</code> this is probably not what we want. We want a newly created file to belong to the same group as the parent folder. Set the <tt>setGID</tt> permission on the parent directory like so:
If we are in <code>/project</code> this is probably not what we want. We want a newly created file to belong to the same group as the parent folder. Enable the <tt>setGID</tt> permission on the parent directory like so:
<source lang="console">
<source lang="console">
[someuser@server]$ chmod g+s dirTest
[someuser@server]$ chmod g+s dirTest
Line 100: Line 100:
-rw-rw-r-- 1 someuser  def-someuser  0 Oct 13 19:39 test02.txt
-rw-rw-r-- 1 someuser  def-someuser  0 Oct 13 19:39 test02.txt
</source>
</source>
If we create a directory inside a directory with the <tt>setGID</tt> set it will have the same group as the parent folder and also have its <tt>setGID</tt> set.
If we create a directory inside a directory with the <tt>setGID</tt> enabled, it will have the same group as the parent folder and also have its <tt>setGID</tt> enabled.
<source lang="console">
<source lang="console">
[someuser@server]$ mkdir dirTest/dirChild
[someuser@server]$ mkdir dirTest/dirChild
rsnt_translations
56,420

edits