-
- Forums
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- OEM Solutions
- Servers: The Right Compute
- Shifting to Software-Defined
- Telecom IQ
- Transforming IT
- Infrastructure Solutions German
- L’Avenir de l’IT
- IT e Trasformazione Digitale
- Enterprise Topics
- ИТ для нового стиля бизнеса
- Blogs
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Forums
-
Blogs
-
InformationEnglish
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-28-2008 02:37 PM
01-28-2008 02:37 PM
In my server i did not set any umask value - but usually the file and dor craeted as 666.
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 .
Anyidea?
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-28-2008 04:22 PM
01-28-2008 04:22 PM
Solutionumask 022
Refer to this link:
http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html
Here is an example of /etc/profile.d/umask.sh:
cat > /etc/profile.d/umask.sh << "EOF"
# By default we want the umask to get set.
if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
umask 002
else
umask 022
fi
EOF
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-28-2008 04:45 PM
01-28-2008 04:45 PM
Re: umask
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.
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.
Hence, the creating code has the "upper limit" of the least restrictive permissions that will apply.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-28-2008 08:52 PM
01-28-2008 08:52 PM
Re: umask
Thanks for the reply.What determines the code to create file with umask 644 .How do we change it.Please any idea?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-29-2008 06:14 AM
01-29-2008 06:14 AM
Re: umask
> What determines the code to create file with umask 644. How do we change it?
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.
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:
# cat mycreate.c
#include
#include
#include
int main() {
int fh;
unlink("/tmp/myfile");
fh = creat("/tmp/myfile",0644);
if (fh > 0) {
printf("file created\n");
}
else {
printf("errno %d\n", errno);
exit(1);
}
}
...or use:
# cat mycreate.pl
#!/usr/bin/perl
use strict;
use Fcntl;
my $file = '/tmp/myfile';
unlink $file;
sysopen( FH, $file, O_CREAT, 0644 ) or die "Error: $!\n";
print "file created\n";
...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.
Regards!
...JRF...
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2019 Hewlett Packard Enterprise Development LP