Forum: Ruby sqlite3/activer record permissions problem (no ror)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
80159acdf89580a20e8e835772b5bf82?d=identicon&s=25 Doug Jolley (ddjolley)
on 2009-02-06 04:03
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
Ed437e52d8d6720308720e7e678f3e6d?d=identicon&s=25 Patrick Doyle (Guest)
on 2009-02-06 14:04
(Received via mailing list)
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
80159acdf89580a20e8e835772b5bf82?d=identicon&s=25 Doug Jolley (ddjolley)
on 2009-02-06 18:06
> 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
80159acdf89580a20e8e835772b5bf82?d=identicon&s=25 Doug Jolley (ddjolley)
on 2009-02-06 19:03
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
Ae36591847393e58ff189704f5eb18f2?d=identicon&s=25 Jeremy Hinegardner (Guest)
on 2009-02-08 08:44
(Received via mailing list)
On Sat, Feb 07, 2009 at 03:02:31AM +0900, Doug Jolley 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
This topic is locked and can not be replied to.