[aklug] Re: Create empty file with specified permission bits

From: Christopher Howard <christopher.howard@frigidcode.com>
Date: Fri Jan 07 2011 - 22:53:52 AKST

On 01/07/11 11:42, Royce Williams wrote:
> Christopher Howard said, on 01/02/2011 07:15 PM:
>> Q: Is there a default Linux command (i.e., just a command, not a
>> function in a programming language) to create an empty file with a
>> specified set of permissions? I looked at TOUCH(1), but I didn't see
>> anything about permission bits or a mode string.
>>
>> Please note, it is important that the file is /created/ with the
>> specified permissions, not created with one set of permissions and
>> altered to another.
> Did you ever get an answer to this? I'm not aware of a default Linux command, but you could use a Perl one-liner as a substitute.
>
> sysopen (MYFILE, 'file.txt', O_RDWR|O_EXCL|O_CREAT, 0755); close (MYFILE);
>
> Royce
>

Turn into quite a discussion at the forums:

http://www.linuxquestions.org/questions/programming-9/program-or-code-to-create-empty-file-with-specified-permissions-854063/

This actually grew out of some research I was doing on another
complicated subject:

http://www.linuxquestions.org/questions/linux-security-4/acls-default-permissions-directories-and-files-853158/

-- 
frigidcode.com
theologia.indicium.us
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Jan 7 22:53:49 2011

This archive was generated by hypermail 2.1.8 : Fri Jan 07 2011 - 22:53:49 AKST