Postgresql Create Tablespace Error Could Not Set Permissions On Directory
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers postgres create tablespace permission denied windows or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x could not set permissions on directory postgres windows Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only could not set permissions on directory permission denied takes a minute: Sign up Creating a tablespace in postgresql up vote 6 down vote favorite 3 I'm trying to create a tablespace in postgres, but I'm getting ownership problems. The command I'm using is: CREATE TABLESPACE magdat OWNER maggie
Error: Could Not Set Permissions On Directory : Operation Not Permitted
LOCATION '/home/john/BSTablespace' I get the error: ERROR: could not set permissions on directory "/home/john/BSTablespace": Operation not permitted The folder belongs to postgres:postgres, I've tried changing it to maggie, but if I go : chown maggie:postgres /home/john/BSTablespace I get: chown: invalid user: `maggie:postgres' How come the user does not exist? If I list the users inside of postgres it does come up. Any ideas what I could be doing wrong? postgresql tablespace chown share|improve this question asked Mar 6 '11 at how to create a tablespace in postgresql 1:45 The_Denominater 4054618 add a comment| 1 Answer 1 active oldest votes up vote 13 down vote accepted I would hazard a guess that the problem lies in the permissions of the parent directory "/home/john". Your home directory is probably setup so that only your user has access (i.e chmod 700) to it (it's a good thing for your home directory to be chmod 700, don't change it). Doing something like: mkdir /BSTablespace chown postgres:postgres /BSTablespace and then CREATE TABLESPACE magdat OWNER maggie LOCATION '/BSTablespace'; should work fine. Regarding the user maggie: database users are not the same as OS users. That isn't to say that you couldn't have a user in both places named maggie-- but you would need to create the user in both the database and the OS for that to happen. share|improve this answer edited Nov 5 '15 at 20:22 answered Mar 6 '11 at 4:02 gsiems 1,6211018 Thanks, that was the problem. Put it in root and there was no problem. –The_Denominater Mar 7 '11 at 0:06 @gsiems update your answer, chown postgres:postgres /Directory. –Giri Nov 3 '15 at 14:27 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the pri
pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured Users International Sites postgres tablespace permissions Propaganda Resources Weekly News Re: CANNOT CREATE A TABLESPACE From: Charles Simard
Postgres List Tablespaces
Create Table Postgres
raw or whole thread) Thread: 2008-07-24 17:06:57 from "JORGE MALDONADO"
messages Graham Leggett Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ http://postgresql.nabble.com/Could-not-create-a-tablespace-permission-denied-td2088909.html ♦ Could not create a tablespace - permission denied Hi all, While attempting to create a tablespace as the postgres user under RHEL5 with *no* SELinux enabled, I https://ubuntuforums.org/showthread.php?t=1824149 get the following error: postgres=# CREATE TABLESPACE fma LOCATION '/home/chandler/fma/db/pgsql'; ERROR: could not set permissions on directory "/home/chandler/fma/db/pgsql": Permission denied The user postgres is able to access could not the directory, and the user postgres is able to set permissions on the directory to 0700: -bash-3.1$ chmod 700 /home/chandler/fma/db/pgsql -bash-3.1$ Does anyone know what I should do to fix this? Regards, Graham -- smime.p7s (4K) Download Attachment Tom Lane-2 Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as could not set Inappropriate ♦ ♦ Re: Could not create a tablespace - permission denied Graham Leggett <[hidden email]> writes: > While attempting to create a tablespace as the postgres user under RHEL5 > with *no* SELinux enabled, I get the following error: > postgres=# CREATE TABLESPACE fma LOCATION '/home/chandler/fma/db/pgsql'; > ERROR: could not set permissions on directory > "/home/chandler/fma/db/pgsql": Permission denied > The user postgres is able to access the directory, and the user postgres > is able to set permissions on the directory to 0700: > -bash-3.1$ chmod 700 /home/chandler/fma/db/pgsql If you can do that from a shell running as postgres, then I think selinux is not so disabled as you think. Ordinary file permissions are applied uniformly to all processes running as a given userid, but selinux is different. regards, tom lane -- Sent via pgsql-admin mailing list ([hidden email]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin Graham Leggett Reply | T
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] Permissions error with PostgreSQL psql process Having an Issue With Posting ? Do you want to help us debug the posting issues ? < is the place to report it, thanks ! Results 1 to 2 of 2 Thread: Permissions error with PostgreSQL psql process Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode August 13th, 2011 #1 gargoyle60 View Profile View Forum Posts Private Message 5 Cups of Ubuntu Join Date Jun 2009 Location Kent, England Beans 32 DistroUbuntu 11.04 Natty Narwhal Permissions error with PostgreSQL psql process Need help please! I have installed PostgreSQL 9.0 in Ubuntu 11.04. The following is a bit long-winded and cross-relates to PostgreSQL, but I'm sure others are using it on Ubuntu so might offer help. I ran the PostgreSQL installation thus: Code: sudo su ./postgresql-9.0.4-1-linux.bin accepting all the installer defaults except specifying the Data Directory as "/home/gary/PostgreSQL/9.0/data/gjd_data/gjd_sentinel_data" (NB. quotes shown here for emphasis only, not entered to the installer) Beforehand I manually created a data directory structure to isolate my personal data files (as myself, not using sudo): Code: mkdir /home/gary/PostgreSQL/ mkdir /home/gary/PostgreSQL/9.0 mkdir /home/gary/PostgreSQL/9.0/data/ mkdir /home/gary/PostgreSQL/9.0/data/gjd_data mkdir /home/gary/PostgreSQL/9.0/data/gjd_data/gjd_sentinel_data I have a personal project database script file (copied from my Windows installation) that I know works perfectly under Windows. It has been modified for the correct paths/locations, etc. for Linux. When run this should create my entire project database, including loading sample data. This script file is called "Z_Build_DB_Linux.sql" I am trying to run psql in batch mode as follows (long command, line wrapped here): Code: /opt/PostgreSQL/9.0/bin/psql --dbname postgres --host localhost --port 5432 --username postgres --file /home/gary/PostgreSQL/9.0/data/gjd_data/Z_Build_DB_Linux.sql --log-fil