From: Miles Smith on
I have a simple IRC Bot that's running with ActiveRecord and a small SQLite3 DB.

When I run as root, the db can be accessed fine, however, when I run it as a normal user, I get a SQLite3::SQLException: unable to open database file: error.

Now I've already chmoded the DB to 0777 and set the owner to the user in question, however the issue still remains.

Any ideas?
From: Phrogz on
On Mar 23, 8:16 pm, Miles Smith <mi...(a)appcon.net> wrote:
> I have a simple IRC Bot that's running with ActiveRecord and a small SQLite3 DB.
>
> When I run as root, the db can be accessed fine, however, when I run it as a normal user, I get a SQLite3::SQLException: unable to open database file: error.
>
> Now I've already chmoded the DB to 0777 and set the owner to the user in question, however the issue still remains.
>
> Any ideas?

Permissions on the directory owning the DB?
From: David Masover on
On Tuesday 23 March 2010 09:16:44 pm Miles Smith wrote:
> When I run as root, the db can be accessed fine, however, when I run it as
> a normal user, I get a SQLite3::SQLException: unable to open database
> file: error.

What happens when you try to access the file with the sqlite3 binary? Or with,
say, the 'file' command? Are you sure it's a Unix permission issue?

> Now I've already chmoded the DB to 0777

Don't do that. Ever.

EVER.

> and set the owner to the user in
> question,

Do that and set the DB to, say, mode 0600. That should be plenty.

> however the issue still remains.
>
> Any ideas?

Phrogz had a good idea with checking the directory, or parent directories.

From: Jeremy Hinegardner on
On Thu, Mar 25, 2010 at 12:50:07PM +0900, David Masover wrote:
> On Tuesday 23 March 2010 09:16:44 pm Miles Smith wrote:
> > When I run as root, the db can be accessed fine, however, when I run it as
> > a normal user, I get a SQLite3::SQLException: unable to open database
> > file: error.
>
> What happens when you try to access the file with the sqlite3 binary? Or with,
> say, the 'file' command? Are you sure it's a Unix permission issue?
>
> > Now I've already chmoded the DB to 0777
>
> Don't do that. Ever.
>
> EVER.
>
> > and set the owner to the user in
> > question,
>
> Do that and set the DB to, say, mode 0600. That should be plenty.
>
> > however the issue still remains.
> >
> > Any ideas?
>
> Phrogz had a good idea with checking the directory, or parent directories.

It will be the permissions on the directory. SQLite needs to write its .journal
to the same directory in which the db file is located.

enjoy,

-jeremy

--
========================================================================
Jeremy Hinegardner jeremy(a)hinegardner.org