<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic umask in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136903#M31455</link>
    <description>Hello All,&lt;BR /&gt;In my server i did not set any umask value - but usually the file and dor craeted as 666.&lt;BR /&gt;I have a oracle user oracle . For that particular user ...the file mode is the same - but not when it creates using some pl / sql command .&lt;BR /&gt;Anyidea?&lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
    <pubDate>Mon, 28 Jan 2008 22:37:08 GMT</pubDate>
    <dc:creator>navin</dc:creator>
    <dc:date>2008-01-28T22:37:08Z</dc:date>
    <item>
      <title>umask</title>
      <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136903#M31455</link>
      <description>Hello All,&lt;BR /&gt;In my server i did not set any umask value - but usually the file and dor craeted as 666.&lt;BR /&gt;I have a oracle user oracle . For that particular user ...the file mode is the same - but not when it creates using some pl / sql command .&lt;BR /&gt;Anyidea?&lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Jan 2008 22:37:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136903#M31455</guid>
      <dc:creator>navin</dc:creator>
      <dc:date>2008-01-28T22:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: umask</title>
      <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136904#M31456</link>
      <description>In /etc/profile.d/umash.sh there should be this setting:&lt;BR /&gt;&lt;BR /&gt;umask 022&lt;BR /&gt;&lt;BR /&gt;Refer to this link:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html" target="_blank"&gt;http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here is an example of /etc/profile.d/umask.sh:&lt;BR /&gt;&lt;BR /&gt;cat &amp;gt; /etc/profile.d/umask.sh &amp;lt;&amp;lt; "EOF"&lt;BR /&gt;# By default we want the umask to get set.&lt;BR /&gt;if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then&lt;BR /&gt;  umask 002&lt;BR /&gt;else&lt;BR /&gt;  umask 022&lt;BR /&gt;fi&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2008 00:22:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136904#M31456</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2008-01-29T00:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: umask</title>
      <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136905#M31457</link>
      <description>Hi Navin:&lt;BR /&gt;&lt;BR /&gt;Two things come into play when a file is created.  First, when a 'create()' system call is performed, the code has the option of specifying an octal permissions value.  The shell uses 666 for files.  Whatever value is supplied, though, is subject to the application of the 'umaask' of the process.  Hence if the 'umask' is 022 and the default permissions for the 'create()' are 666, the "subtraction" of the two means that the created file will have permissions of 644.  With a creation mask of 666 and a 'umask' of 000, the file has permissions of 666.&lt;BR /&gt;&lt;BR /&gt;If the code performing the file creation uses a creation mask of 644 (instead of 666), then even with a 'umask' of 000, a resulting file will have permissions of 644.&lt;BR /&gt;&lt;BR /&gt;Hence, the creating code has the "upper limit" of the least restrictive permissions that will apply.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 29 Jan 2008 00:45:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136905#M31457</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-01-29T00:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: umask</title>
      <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136906#M31458</link>
      <description>James&lt;BR /&gt;Thanks for the reply.What determines the code to create file with umask 644 .How do we change it.Please any idea?&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 29 Jan 2008 04:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136906#M31458</guid>
      <dc:creator>navin</dc:creator>
      <dc:date>2008-01-29T04:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: umask</title>
      <link>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136907#M31459</link>
      <description>&lt;!--!*#--&gt;Hi (again) Navin:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; What determines the code to create file with umask 644. How do we change it?&lt;BR /&gt;&lt;BR /&gt;I'll use an example in C and in Perl --- the syntax is close and the concept is identical.  The following code will create a file called "/tmp/myfile" with permissions of 644 (-rw-r--r--) *EVEN WHEN* your 'umask' has been set to zero (000).  This demonstrates that setting the MODE during a 'creat()' to other than 666 (the default) takes away the user's ability to have a more permissive permissions by default.&lt;BR /&gt;&lt;BR /&gt;In a shell, set your 'umask' to zero (000) and then run either of these pieces of code.  You will need to compile the C code first, of course:&lt;BR /&gt;&lt;BR /&gt;# cat mycreate.c&lt;BR /&gt;#include &lt;ERRNO.H&gt;&lt;BR /&gt;#include &lt;FCNTL.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;    int fh;&lt;BR /&gt;    unlink("/tmp/myfile");&lt;BR /&gt;    fh = creat("/tmp/myfile",0644);&lt;BR /&gt;    if (fh &amp;gt; 0) {&lt;BR /&gt;        printf("file created\n");&lt;BR /&gt;    }&lt;BR /&gt;    else {&lt;BR /&gt;        printf("errno %d\n", errno);&lt;BR /&gt;        exit(1);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...or use:&lt;BR /&gt;&lt;BR /&gt;# cat mycreate.pl&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use Fcntl;&lt;BR /&gt;my $file = '/tmp/myfile';&lt;BR /&gt;unlink $file;&lt;BR /&gt;sysopen( FH, $file, O_CREAT, 0644 ) or die "Error: $!\n";&lt;BR /&gt;print "file created\n";&lt;BR /&gt;&lt;BR /&gt;...in either example, the MODE of the file during creation is set to octal 644.  Hence, applying a umask of 000 or 022 still leaves a permission of 644 (-rw-r--r--) for the resulting file.  Had the code used a default MODE of 666, then a umask of 000 would have given a file with octal permissions of 666.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/STDIO.H&gt;&lt;/FCNTL.H&gt;&lt;/ERRNO.H&gt;</description>
      <pubDate>Tue, 29 Jan 2008 14:14:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/umask/m-p/4136907#M31459</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-01-29T14:14:16Z</dc:date>
    </item>
  </channel>
</rss>

