Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- 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...