Postgres错误:无法打开文件进行读取:权限被拒绝 [英] Postgres ERROR: could not open file for reading: Permission denied

查看:551
本文介绍了Postgres错误:无法打开文件进行读取:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

计算机:Mac OS X,版本10.8
数据库:Postgres

Computer: Mac OS X, version 10.8 Database: Postgres

尝试将csv文件导入postgres。

Trying to import csv file into postgres.

pg> copy items_ordered from '/users/darchcruise/desktop/items_ordered.csv' with CSV;
ERROR:  could not open file "/users/darchcruise/desktop/items_ordered.csv" for reading: Permission denied

然后我尝试了

$> chown postgres /users/darchcruise/desktop/items_ordered.csv
chown: /users/darchcruise/desktop/items_ordered.csv: Operation not permitted

最后,我尝试了

$> ls -l
-rw-r--r--  1 darchcruise  staff      1016 Oct 18 21:04 items_ordered.csv

非常感谢您的帮助!

推荐答案

chmod a+rX /users/darchcruise/ /users/darchcruise/desktop /users/darchcruise/desktop/items_ordered.csv

这将更改文件夹的访问权限。请注意,每个人都可以读取您的文件。
您不能将chown用作没有管理权限的用户。
还可以考虑学习 umask 以简化共享文件的创建。

This will change access rights for your folder. Note that everyone will be able to read your file. You can't use chown being a user without administrative rights. Also consider learning umask to ease creation of shared files.

这篇关于Postgres错误:无法打开文件进行读取:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆