Sqlite3/activer record permissions problem (no ror)


#1

I’m using Ruby and ActiveRecord in a web environment (no ror). The
database is sqlite3. sqlite3-ruby is installed. I can add records to
the database from Ruby scripts using ActiveRecord just fine provided
that I am root. However, as any other user it bombs out with the error
message shown below. If this is going to work for me, I need to have
the user ‘Apache’ be able to add records to the database. Can anyone
please tell me what the problem is and how I might fix it. Thanks for
any input. Here is the relevant part of the error message:

/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log’: SQLite3::SQLException: SQL logic error or missing database:
INSERT INTO news


#2

My guess is that the sqlite database is owned by root (or by anybody
other
than the user ‘Apache’) and does not have world write privileges. Look
at
the permissions on the database file.

–wpd


#3

My guess is that the sqlite database is owned by root (or by anybody
other than the user ‘Apache’) and does not have world write privileges.
Look at the permissions on the database file.

Unfortunately, the database is owned by ‘apache’ and assigned to the
group ‘apache’. In addition, at the moment the database has world write
permissions. I am hopeful that after I get this problem resolved, the
write permissions can be restricted to a single user, presumably
‘apache’. Thanks for your input. I should have mentioned those facts
in my post.

    ... doug

#4

FWIW, I just got this working by making the directory that contains the
database owned by ‘apache’ and and assigned to the ‘apache’ group.
Thanks for the help.

 ... doug

#5

On Sat, Feb 07, 2009 at 03:02:31AM +0900, Doug J. wrote:

FWIW, I just got this working by making the directory that contains the
database owned by ‘apache’ and and assigned to the ‘apache’ group.
Thanks for the help.

 ... doug

That would be because sqlite needs write permissions to the directory so
it may
create the .journal file.

enjoy,

-jeremy