Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDO SQLite create database default permissions

When using PDO sqlite PHP adapter, new sqlite database file is created with group permission set to read-only, and does not honor umask.

I need every database file to be writable by group. Any way to accomplish it?

Edit: I know how to change permissions of a file, I'm asking whether it is possible to create it with correct permissions (according to process umask) or not.

like image 663
Dmitri Pisarev Avatar asked Dec 02 '25 15:12

Dmitri Pisarev


1 Answers

It looks like there's a SQLITE_DEFAULT_FILE_PERMISSIONS compilation parameter.

It seems umask is applied on top of it to restrict it, if necessary. So it makes sense to recompile with SQLITE_DEFAULT_FILE_PERMISSIONS=666 and than rely on umask. Too bad it's not a default option in sqlite.

like image 69
Dmitri Pisarev Avatar answered Dec 05 '25 03:12

Dmitri Pisarev