- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: default file permissions to 666
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
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
тАО05-29-2004 11:43 PM
тАО05-29-2004 11:43 PM
default file permissions to 666
I've been looking throughout man pages to see where I could find the place where the default 666 mode was explicitly specified when creating new files. I was even taking a look at creat(2), but found no answer.
It looks like the system always do a:
/* C jargon */
extern mode_t curr_proc_umask;
...
creat("path_of_my_file", 0666 & ~curr_proc_umask);
...
Where can I find some official documentation stating this or giving details on this?
Thanks in advance,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2004 11:55 PM
тАО05-29-2004 11:55 PM
Re: default file permissions to 666
If not alreadey checked, pls check the umask. If the umask is set 000, files created could have 666 permissions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 01:26 AM
тАО05-30-2004 01:26 AM
Re: default file permissions to 666
mode.
Again:
It looks like the system always do a:
/* C jargon */
extern mode_t curr_proc_umask;
...
creat("path_of_my_file", 0666 & ~curr_proc_umask);
...
I mean it looks that *always* there's a 0666 harcoded whenever I creat(2) a file?
Where can I find some official documentation stating this or giving details on this?
Thanks in advance,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 02:08 AM
тАО05-30-2004 02:08 AM
Re: default file permissions to 666
/* BEGINNING CODE 1 */
#include
int main(void)
{
mode_t mymode = 0666;
(void) creat("this_is_just_a_test", mymode);
return 0;
}
/* END OF CODE 1 */
/* BEGINNING CODE 2 */
#include
int main(void)
{
mode_t mymode = 0;
(void) creat("this_is_just_another_test", mymode);
return 0;
}
/* END OF CODE 2 */
I assume that programs like touch(1) really behave backstage like CODE 1 setting mymode to 0666 when creating files.
On the other hand a program like mkdir(1) set mymode to 0777 when calling mkdir(2).
Any input will be greatly appreciated...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 03:53 AM
тАО05-30-2004 03:53 AM
Re: default file permissions to 666
When files are created they are created by default with 666 permissions, THEN whatever your umask is set to is essentially subtracted from the default.
Directories are created by default with 777 permissions and the umask is then subtracted from the default to give the actual permissions.
Is there something you are trying to do? Are you trying to change the default file mode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 04:35 AM
тАО05-30-2004 04:35 AM
Re: default file permissions to 666
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 07:14 PM
тАО05-30-2004 07:14 PM
Re: default file permissions to 666
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2004 09:01 PM
тАО05-30-2004 09:01 PM
Re: default file permissions to 666
Files opened with with "a+" argument in fopen libc call enforce 0666 & ~umask may be that is extended to creat(2) too.
You may have to set umask to zero before calling creat() and
restoring it back after the file creation operation.
Manpage of umask(2) man be useful.
manish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2004 11:25 AM
тАО05-31-2004 11:25 AM
Re: default file permissions to 666
I think you pinpointed the issue here. As you clearly exposed that is in no way enforced by underlying Operating System API.
It's just the shell that sets 0666 for files and 0777 for dirs. Nevertheless I've been looking in vane for official documentation that states this common (but undocumented)behavior... :(