pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Maksim Milyutin <milyutinma@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Hint to set owner for tablespace directory
Date: Fri, 31 Aug 2018 15:37:06 +0300
Message-ID: <2615ea98-6537-1fcf-667a-09022063336a@postgrespro.ru> (raw)
In-Reply-To: <1bc2bc14-e42a-8d9c-d47c-3afac05de347@2ndquadrant.com>
References: <5ca60e1a-26f9-89fd-e912-021dd2b8afe2@gmail.com>
	<1bc2bc14-e42a-8d9c-d47c-3afac05de347@2ndquadrant.com>

30.08.2018 19:52, Peter Eisentraut wrote:

> On 23/08/2018 13:24, Maksim Milyutin wrote:
>> I have noticed the novice users are stuck trying to create tablespace
>> over a directory whose owner is not the system postgres user. They
>> observed the message "could not set permissions on directory ...:
>> permission denied".
>>
>> I want to add patch that prints hint to set required owner for the
>> tablespace directory if this is the cause of the problem (*errno ==
>> EPERM* after calling *chmod*).
> I think the hint is backwards.  When you don't have permission to chmod
> the tablespace directory, you probably want to fix the permissions on
> the tablespace directory or its parent.

According with man page of chmod(2) when permissions on parent 
directories are insufficient the errno takes the EACCES value. However, 
in Linux man page of chmod(2) there been mentioned that the process 
could be not privileged (does not have the CAP_FOWNER capability) when 
errno is EPERM.

> But the hint says to run the database server as a different user.  That's a bit unusual.

In this case I propose to:
- replace my initial hint message to the guess what to do if errno == 
EPERM, smth like "You might need to install the PostgreSQL system user 
as the owner of this directory";
- add another hint if errno == EACCES: "Fix permissions on the parent 
directories".

Any thoughts?

-- 
Regards,
Maksim Milyutin





view thread (19+ messages)  latest in thread

Message-ID: <2615ea98-6537-1fcf-667a-09022063336a@postgrespro.ru>
Permalink:  ../2615ea98-6537-1fcf-667a-09022063336a@postgrespro.ru/
Also on:    postgresql.org/message-id/2615ea98-6537-1fcf-667a-09022063336a@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: milyutinma@gmail.com, peter.eisentraut@2ndquadrant.com
  Subject: Re: Hint to set owner for tablespace directory
  In-Reply-To: <2615ea98-6537-1fcf-667a-09022063336a@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox