尝试创建文件时出现 Firebird 错误,权限被拒绝
Firebird Error while trying to create file, Permission denied
我正在尝试创建一个 Firebird database in my home directory through Flamerobin 但是我总是得到
*** IBPP::SQLException ***
Context: Database::Create
Message: isc_dsql_execute_immediate failed
SQL Message : -902
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements
Engine Code : 335544344
Engine Message :
I/O error during "open O_CREAT" operation for file "/home/user/test.fdb"
Error while trying to create file
Permission denied
即使文件是 chmod 777,文件 /etc/firebird/2.5/firebird.conf 也已被修改为:
DatabaseAccess = Full
设置为允许访问所有文件。
服务是 运行:
$ ps ax | grep fireb
3909 ? S 0:00 /usr/sbin/fbguard -daemon -forever -pidfile /var/run/firebird/2.5/fbserver.pid
尽管奇怪的是 netstat 没有找到连接端口:
netstat | grep 3050
和returns空列表。
如果我连接到现有数据库,一切正常,例如连接到
/var/lib/firebird/2.5/system/help.fdb
正确显示表格。
检查 /home/user 所有者和模式以及 firebird 进程所有者。我很确定用户 which 运行 firebird 没有访问这个目录的权限。
我看到两个可能的原因:
你提到文件是chmod 777,这意味着文件已经存在,所以创建新数据库会失败。
您正在尝试通过 Firebird 服务器在用户文件夹(我假设是您的文件夹)中创建(或连接)文件(尽管事实上没有服务器 运行 可能表明事实并非如此。
我假设 Firebird 服务器不在您的帐户下 运行(但在 firebird 用户下),因此不允许访问您文件夹中的文件。
您需要在 Firebird 用户具有足够访问权限的位置创建(或访问)数据库,或者使用本地(嵌入式)连接(尽管我不确定 flamerobin 是否支持。
你必须做一些事情……首先,让我们看看安全方面的东西……
在文件中/etc/firebird/2.5/firebird.conf
部分:DatabaseAccess 必须是这样的:
DatabaseAccess Restrict /the/directory/you/want/to/put/the/database
现在,在文件中 /etc/firebird/2.5/aliases.conf
你输入别名和目录...
diryouwant = /the/directory/you/want/to/put/the/database/database.fdb
像这样保存并重启 firebird 服务:
sudo service firebird-2.5"theversionyouhave" restart
您必须像这样更改目录所有者:
sudo chown firebird.firebird /the/directory/you/want/to/put/the/database
现在您可以毫无问题地使用 flamerobin...
我遇到了同样的问题,如上所述,在 Oracle Linux OS 中尝试 运行 firebird 2.5,无法使用 gbak 恢复任何数据库,同样的错误消息。
经过搜索,我找到了一个关于目标目录和临时目录权限的答案。
我的解决方案:作为 root:
先重新运行 firebird installer 确认安装没有问题;
之后,在 /(例如 /fdb)上为 firebird 数据库创建特定目录,
将备份文件移动到该目录;
使用此命令将整个目录的所有者更改为 firebird
chown firebird /fdb -R
chmod 700 firebird /fdb -R
在此之后,gbak 通常适合我,运行将其设置为 root。
参考:http://forums.devshed.com/firebird-sql-development-61/gbak-restore-linux-453690.html
我正在尝试创建一个 Firebird database in my home directory through Flamerobin 但是我总是得到
*** IBPP::SQLException ***
Context: Database::Create
Message: isc_dsql_execute_immediate failed
SQL Message : -902
Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements
Engine Code : 335544344
Engine Message :
I/O error during "open O_CREAT" operation for file "/home/user/test.fdb"
Error while trying to create file
Permission denied
即使文件是 chmod 777,文件 /etc/firebird/2.5/firebird.conf 也已被修改为:
DatabaseAccess = Full
设置为允许访问所有文件。 服务是 运行:
$ ps ax | grep fireb
3909 ? S 0:00 /usr/sbin/fbguard -daemon -forever -pidfile /var/run/firebird/2.5/fbserver.pid
尽管奇怪的是 netstat 没有找到连接端口:
netstat | grep 3050
和returns空列表。
如果我连接到现有数据库,一切正常,例如连接到
/var/lib/firebird/2.5/system/help.fdb
正确显示表格。
检查 /home/user 所有者和模式以及 firebird 进程所有者。我很确定用户 which 运行 firebird 没有访问这个目录的权限。
我看到两个可能的原因:
你提到文件是chmod 777,这意味着文件已经存在,所以创建新数据库会失败。
您正在尝试通过 Firebird 服务器在用户文件夹(我假设是您的文件夹)中创建(或连接)文件(尽管事实上没有服务器 运行 可能表明事实并非如此。
我假设 Firebird 服务器不在您的帐户下 运行(但在 firebird 用户下),因此不允许访问您文件夹中的文件。
您需要在 Firebird 用户具有足够访问权限的位置创建(或访问)数据库,或者使用本地(嵌入式)连接(尽管我不确定 flamerobin 是否支持。
你必须做一些事情……首先,让我们看看安全方面的东西……
在文件中/etc/firebird/2.5/firebird.conf
部分:DatabaseAccess 必须是这样的:
DatabaseAccess Restrict /the/directory/you/want/to/put/the/database
现在,在文件中 /etc/firebird/2.5/aliases.conf
你输入别名和目录...
diryouwant = /the/directory/you/want/to/put/the/database/database.fdb
像这样保存并重启 firebird 服务:
sudo service firebird-2.5"theversionyouhave" restart
您必须像这样更改目录所有者:
sudo chown firebird.firebird /the/directory/you/want/to/put/the/database
现在您可以毫无问题地使用 flamerobin...
我遇到了同样的问题,如上所述,在 Oracle Linux OS 中尝试 运行 firebird 2.5,无法使用 gbak 恢复任何数据库,同样的错误消息。
经过搜索,我找到了一个关于目标目录和临时目录权限的答案。
我的解决方案:作为 root:
先重新运行 firebird installer 确认安装没有问题;
之后,在 /(例如 /fdb)上为 firebird 数据库创建特定目录,
将备份文件移动到该目录;
使用此命令将整个目录的所有者更改为 firebird
chown firebird /fdb -R
chmod 700 firebird /fdb -R
在此之后,gbak 通常适合我,运行将其设置为 root。
参考:http://forums.devshed.com/firebird-sql-development-61/gbak-restore-linux-453690.html