Postgres Error Could Not Set Permissions On Directory
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 postgres create tablespace permission denied windows site About Us Learn more about Stack Overflow the company Business Learn more
Could Not Set Permissions On Directory Postgres Windows
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Error: Could Not Set Permissions On Directory : Operation Not Permitted
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 takes a minute: Sign up Creating a tablespace
How To Create A Tablespace In Postgresql
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 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 postgres tablespace permissions : 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 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 2
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 postgres list tablespaces groups Project lists Inactive lists IRC Local User Groups create table postgres Featured Users International Sites Propaganda Resources Weekly News Re: Could not create a tablespace - permission denied From: "Joshua D(dot) Drake" To: Graham Leggett Cc: Tom Lane , pgsql-admin(at)postgresql(dot)org Subject: Re: Could not create a tablespace http://stackoverflow.com/questions/5208094/creating-a-tablespace-in-postgresql - permission denied Date: 2008-04-19 16:14:13 Message-ID: 480A1A55.6090800@commandprompt.com (view raw or whole thread) Thread: 2008-04-19 12:58:35 from Graham Leggett 2008-04-19 15:34:01 from Tom Lane 2008-04-19 15:42:45 from Graham Leggett 2008-04-19 15:50:29 from Tom Lane 2008-04-19 16:08:43 from Graham Leggett 2008-04-19 16:14:13 from https://www.postgresql.org/message-id/480A1A55.6090800@commandprompt.com "Joshua D(dot) Drake" 2008-04-19 18:21:17 from Graham Leggett 2008-04-19 18:51:53 from "Joshua D(dot) Drake" 2008-04-19 21:11:02 from Tom Lane 2008-04-19 16:17:31 from Tom Lane Lists: pgsql-admin Graham Leggett wrote: > After the postgres user was granted permission to access the tablespace > directory, and after it was verified that the postgres user was able to > access the tablespace directory, postgresql refused to allow the > tablespace to be created until the postgresql server was restarted. I am pretty sure you are missing something. I can not reproduce your issue: jd(at)scratch:~$ mkdir /tmp/foo jd(at)scratch:~$ psql -U postgres postgres=# \h create tablespace Command: CREATE TABLESPACE Description: define a new tablespace Syntax: CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory' postgres=# create tablespace foobar location '/tmp/foo'; ERROR: could not set permissions on directory "/tmp/foo": Operation
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 https://www.postgresql.org/message-id/CAALYutfvAYm%3D0yka5a3n5ipMw-HXMtP6H%2BPN%2BVuE3Sk_Wmx36g@mail.gmail.com Featured Users International Sites Propaganda Resources Weekly News Re: Error creating https://www.postgresql.org/message-id/9189.1208619241@sss.pgh.pa.us Tablespace on Windows From: deepak To: John R Pierce Cc: "pgsql-general(at)postgresql(dot)org" Subject: Re: Error creating Tablespace on Windows Date: 2015-11-25 22:06:39 Message-ID: CAALYutfvAYm=0yka5a3n5ipMw-HXMtP6H+PN+VuE3Sk_Wmx36g@mail.gmail.com (view raw or whole thread) Thread: 2015-11-25 20:01:57 from deepak 2015-11-25 20:15:00 from John R Pierce 2015-11-25 could not 22:06:39 from deepak 2015-11-26 01:49:59 from Begin Daniel Lists: pgsql-general I chose temp only for illustration purposes. Actually the regression test "tablespace" fails too, for the same reason, when run from sources (which creates a tablespace directory under src/test/regress) -- Deepak On Wed, Nov 25, 2015 at 2:15 PM, John R Pierce wrote: could not set > On 11/25/2015 12:01 PM, deepak wrote: > >> I am getting this permission denied error on Windows 2008 trying to >> create a tablespace. >> >> template1=# create tablespace testtablespace location >> 'c:/windows/temp1/testtablespace'; >> ERROR: could not set permissions on directory >> "c:/windows/temp1/testtablespace": Permission denied >> > > > why are you putting database tables in the Windows directory?!? I would > instead put them somewhere like > > C:\Users\postgres\AppData\Local\Temp (assuming C:\Users\postgres is the > %USERPROFILE% directory for the postgres service owner...) > > > > -- > john r pierce, recycling bits in santa cruz > > > > -- > Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > In response to Re: Error creating Tablespace on Windows at 2015-11-25 20:15:00 from John R Pierce Responses Re: Error creating Tablespace on Windows at 2015-11-26 01:49:59 from Begin Daniel pgsql-general by date Next:From: Jeff JanesDate: 2015-11-26 01:24:08 Subject: Re: using a postgres table as a multi-writer multi-updater queu
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 Propaganda Resources Weekly News Re: Could not create a tablespace - permission denied From: Tom Lane To: Graham Leggett Cc: pgsql-admin(at)postgresql(dot)org Subject: Re: Could not create a tablespace - permission denied Date: 2008-04-19 15:34:01 Message-ID: 9189.1208619241@sss.pgh.pa.us (view raw or whole thread) Thread: 2008-04-19 12:58:35 from Graham Leggett 2008-04-19 15:34:01 from Tom Lane 2008-04-19 15:42:45 from Graham Leggett 2008-04-19 15:50:29 from Tom Lane 2008-04-19 16:08:43 from Graham Leggett 2008-04-19 16:14:13 from "Joshua D(dot) Drake" 2008-04-19 18:21:17 from Graham Leggett 2008-04-19 18:51:53 from "Joshua D(dot) Drake" 2008-04-19 21:11:02 from Tom Lane 2008-04-19 16:17:31 from Tom Lane Lists: pgsql-admin Graham Leggett 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. regard