Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread John Stanton
It would be better to make the create permission 0666.  Then umask can 
restrict that permission and the user can get whatever permission 
required by the application.


Joe Wilson wrote:

--- "Shan, Zhe (Jay)" <[EMAIL PROTECTED]> wrote:


I've tried umask, but it does not work for SQLite.



Here are the default permissions used with open()'s O_CREAT flag:

 src/os_os2.h:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0600
 src/os_unix.c:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644

But umask still plays a role in this (I can never remember the umask
number's effect without experimentation). 


man open:

SYNOPSIS

 #include 

 int open(const char *path, int flags, mode_t mode);

DESCRIPTION

 The file name specified by path is opened for reading and/or 
 writing as specified by the argument flags and the file descriptor 
 returned to the calling process.  The flags argument may indicate 
 the file is to be created if it does not exist (by specifying the 
 O_CREAT flag), in which case the file is created with mode mode as 
 described in chmod(2) and modified by the process' umask value (see 
 umask(2)).


Another option is to create a zero-length sqlite database file yourself 
through other means (touch, chmod, etc) before you call sqlite3_open().



 


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread Martin Jenkins

Joe Wilson wrote:

I can never remember the umask number's effect without 
experimentation


DESCRIPTION
   umask sets the umask to mask & 0777.

The  umask  is used by open(2) to set initial file permissions on a
newly-created file.  Specifically, permissions in the umask are turned
off from the mode argument to open(2) (so, for example, the common umask
default value of 022 results in new files being created with permissions
0666 & ~022 = 0644 = rw-r--r-- in the usual case where the  mode  is
specified as 0666).

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread Joe Wilson
--- "Shan, Zhe (Jay)" <[EMAIL PROTECTED]> wrote:
> I've tried umask, but it does not work for SQLite.

Here are the default permissions used with open()'s O_CREAT flag:

 src/os_os2.h:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0600
 src/os_unix.c:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644

But umask still plays a role in this (I can never remember the umask
number's effect without experimentation). 

man open:

SYNOPSIS

 #include 

 int open(const char *path, int flags, mode_t mode);

DESCRIPTION

 The file name specified by path is opened for reading and/or 
 writing as specified by the argument flags and the file descriptor 
 returned to the calling process.  The flags argument may indicate 
 the file is to be created if it does not exist (by specifying the 
 O_CREAT flag), in which case the file is created with mode mode as 
 described in chmod(2) and modified by the process' umask value (see 
 umask(2)).

Another option is to create a zero-length sqlite database file yourself 
through other means (touch, chmod, etc) before you call sqlite3_open().


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] about default file permission of SQLite database file

2007-02-22 Thread Shan, Zhe (Jay)

I've tried umask, but it does not work for SQLite.

I search this emaillist, and find the following message in 2003 which is
related to this topic. I want to check if it is still true in the current
version. Thanks.

Jay


From: Dong Xuezhang-A19583

<[EMAIL 
PROTECTED]


Subject: SQLITE 
MODE
Newsgroups: 
gmane.comp.db.sqlite.general
Date: 2003-09-30 18:30:11 GMT (3 years, 20 weeks, 4 days, 14 hours and 24

minutes ago)


Hi,

Just want to buy some idea from you guys about the *permission* of

sqlite db *file*. It is hardcode to 644 right

now(user RW, group and other person R). In certain case, like group

developing or ..., you may want 664 or

even 666. There are two way to do this, one is make it become a

compilation option, another one is the pass in a

parameter from sqlite_open method. I notice that there is a parameter

(int mode) in sqlite_open never

been used, is it a good idea to use it for this purpose?

Thanks.


Xuezhang.




On 2/21/07, Joe Wilson <[EMAIL PROTECTED]> wrote:


--- "Shan, Zhe (Jay)" <[EMAIL PROTECTED]> wrote:
> If to use SQLite to create a database in Linux, the database file will
> be granted permission 644 as default.
> Is this value hardcoded in the current version? Is it possible to
> change this default vaule, say to 664 or something else?

man umask






Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




Re: [sqlite] about default file permission of SQLite database file

2007-02-21 Thread miguel manese

This is not actually about SQLite. man umask

M. Manese

On 2/22/07, Shan, Zhe (Jay) <[EMAIL PROTECTED]> wrote:

Hi,

If to use SQLite to create a database in Linux, the database file will
be granted permission 644 as default.
Is this value hardcoded in the current version? Is it possible to
change this default vaule, say to 664 or something else?


Thanks.

Jay



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] about default file permission of SQLite database file

2007-02-21 Thread Shan, Zhe (Jay)

Hi,

If to use SQLite to create a database in Linux, the database file will
be granted permission 644 as default.
Is this value hardcoded in the current version? Is it possible to
change this default vaule, say to 664 or something else?


Thanks.

Jay