473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to create file with permission 666?

Hi,

I have a question about the open function in linux. I want to create a file with permission 666(read and write by others), the code as following:

open("/tmp/test", O_CREAT, 0666);

But the file always can not set the others write permission, could someone help me on this question?
Thanks,
Eric
Nov 15 '05 #1
4 9064
"Eric J.Hu" <eh*@lucent.com> writes:
I have a question about the open function in linux. I want to create a
file with permission 666(read and write by others), the code as following:

open("/tmp/test", O_CREAT, 0666);

But the file always can not set the others write permission, could someone
help me on this question?


Not here. Try comp.unix.programmer.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #2

Eric J.Hu wrote:
Hi,

I have a question about the open function in linux. I want to create a file with permission 666(read and write by others), the code as following:

open("/tmp/test", O_CREAT, 0666);

But the file always can not set the others write permission, could someone help me on this question?
Thanks,
Eric


<OT>
The third argument mode specified in the open system call, is modified
by the process's
"umask". The permissions of the created file are (mode & ~umask).
I guess the umask set for your process is 022.
You may see the current umask setting by command "umask".
See the man page for umask for details.
<OT>

Nov 15 '05 #3
Junky_fellow,

Great thanks! It works, the problem is my umask was set to 022.
Regards,
Eric
------------------------------------------
<ju**********@yahoo.co.in> wrote in message news:11**********************@g14g2000cwa.googlegr oups.com...

Eric J.Hu wrote:
Hi,

I have a question about the open function in linux. I want to create a file with permission 666(read and write by others), the code as following:

open("/tmp/test", O_CREAT, 0666);

But the file always can not set the others write permission, could someone help me on this question?
Thanks,
Eric


<OT>
The third argument mode specified in the open system call, is modified
by the process's
"umask". The permissions of the created file are (mode & ~umask).
I guess the umask set for your process is 022.
You may see the current umask setting by command "umask".
See the man page for umask for details.
<OT>

Nov 15 '05 #4
Eric J.Hu <eh*@lucent.com> wrote:
[-- text/plain, encoding quoted-printable, charset: iso-8859-1, 14 lines --] I have a question about the open function in linux. I want to create a file with permission 666(read and write by others), the code as following: (snipped)


And when you post to comp.unix.programmer as Keith recommended, I'm
quite sure they would appreciate it if you would avoid posting
multipart-encoded messages.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
3
by: fripper | last post by:
When testing a VB .Net application on my system (with IIS installed) I get an error message when using the fileopen function and the file does not exist ... i.e. I want fileopen to create the file....
6
by: Steve Richter | last post by:
I am getting error in a vbscript: ActiveX component cant create object: Excel.Application. The vbscript code is: Dim objExcel Set objExcel = CreateObject("Excel.Application") I am pretty...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
1
by: Matt F | last post by:
I need to create a folder in code, and also set sharing to being shared to everyone with full control (or some such variation of security) What I'm doing now is: If Not...
16
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an...
3
by: brook | last post by:
hey all - i´m new to php and having trouble writing a simple code which should create a file. here is the most simplified version: <?php $content = "my content"; $path = "test.txt";...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.