为什么Dropbox导致PostgreSQL权限被拒绝错误? [英] Why Dropbox causes PostgreSQL permission denied errors?
问题描述
我使用软件包管理器 apt-get 安装了 postgresql-common 和 postgresql-9.4 。
我将数据库系统从OSX更改为Debian 8.1,此后遇到权限拒绝错误。
用户 postgres 存在( CREATE USER postgres;
),数据库 detector 存在使用OWNER = postgres创建数据库检测器;
)。
I installed postgresql-common and postgresql-9.4 with the package manager apt-get.
I changed my database system from OSX to Debian 8.1 after which I have had difficulties with Permission denied errors.
The user postgres exists (CREATE USER postgres;
) and database detector exists CREATE DATABASE detector WITH OWNER=postgres;
).
我运行成功
masi@pc212:~$ sudo -u postgres psql detector -c "DROP TABLE measurements;"DROP TABLE
masi@pc212:~$ sudo -u postgres psql detector -c "CREATE TABLE measurements ( m_id SERIAL PRIMARY KEY NOT NULL, m_size INTEGER NOT NULL );"
CREATE TABLE
,但在Dropbox -directory中失败相同
but the same unsuccessfully in Dropbox -directory
masi@pc212:~$ cd Dropbox/
masi@pc212:~/Dropbox$ sudo -u postgres psql detector -c "DROP TABLE measurements;"
could not change directory to "/home/masi/Dropbox": Permission denied
DROP TABLE
masi@pc212:~/Dropbox$ sudo -u postgres psql detector -c "CREATE TABLE measurements ( m_id SERIAL PRIMARY KEY NOT NULL, m_size INTEGER NOT NULL );"
could not change directory to "/home/masi/Dropbox": Permission denied
CREATE TABLE
设置
命令 psql
在 / etc / sudoers :
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
命令 psql
给出 / usr / bin / psql
。
我保存的真实目录代码为 / home / masi / Dropbox / det / ,其中Dropbox的安装可能会影响到事情:
The real directory where I keep the code is /home/masi/Dropbox/det/ where possibly the Dropbox installation is affecting thing:
- drwxr-xr-x 32 masi masi 4096 Jul 14 10:27 masi /
- drwx ------ 26 masi masi 4096 Jul 13 16:05 Dropbox /
- drwxr-xr-x 8个masi开发人员4096 Jul 14 09:22 det /
在这里我可以更改Dropbox到
where I can change the Dropbox to
- drwx ------ 26位masi开发人员4096 Jul 13 16:05 Dropbox /
但无法增加权限,因为我开始获得 ls:尽管具有完全打开的权限,但无法访问../../Dropbox/:权限被拒绝。
这是一个非常奇怪的行为,在这里完全开放的权限会导致这种行为。
but not able to increase permissions because I start to get ls: cannot access ../../Dropbox/: Permission denied although having fully open permissions. This is a very strange behaviour that here fully open permissions lead to such a behaviour.
类似错误
- 此关于nautilus-dropbox的线程,但我的系统中没有 nautilus-dropbox
- this thread about nautilus-dropbox but no nautilus-dropbox in my system
为什么Dropbox会导致PostgreSQL这样的问题?
Why Dropbox is causing such a problem to PostgreSQL?
推荐答案
Petesh的评论中有一些答案,但还需要读取-flag。
运行
Some piece of answer in Petesh's comment but also read -flag is required. Run
sudo chmod -R go=rx /home/masi/Dropbox
,但请尽量避免递归。
该命令允许随后的 sudo -u postgres
命令。 通常,您必须打开对目录和所有父目录的访问权限,以允许命令使用目录中的文件。在所有情况下执行s的权限还不够。还需要read -flag。
but avoid recursive if you can.
The command allows the subsequent sudo -u postgres
commands. You generally have to open up access to the directory and all parent directories enough to allow commands to work with files in the directory. Execute s not enough in all cases; read -flag is also required.
这篇关于为什么Dropbox导致PostgreSQL权限被拒绝错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!