Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1poPJC-0005eh-B8 for pgsql-novice@arkaria.postgresql.org; Mon, 17 Apr 2023 13:54:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1poPJB-0002fQ-1q for pgsql-novice@arkaria.postgresql.org; Mon, 17 Apr 2023 13:54:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1poPJA-0002fH-Ph for pgsql-novice@lists.postgresql.org; Mon, 17 Apr 2023 13:54:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1poPJ7-000KGp-Py for pgsql-novice@lists.postgresql.org; Mon, 17 Apr 2023 13:54:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 33HDsBnC2416659; Mon, 17 Apr 2023 09:54:11 -0400 From: Tom Lane To: Johan Antonissen cc: pgsql-novice@lists.postgresql.org Subject: Re: In-reply-to: References: Comments: In-reply-to Johan Antonissen message dated "Mon, 17 Apr 2023 09:31:59 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2416656.1681739651.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Apr 2023 09:54:11 -0400 Message-ID: <2416657.1681739651@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Johan Antonissen writes: > However when I try to deploy django and connect to my postgres server > postgres gives me a permission error: > python manage.py sqlcreate | sudo -u postgres psql -U postgres > results to: > Could not change directory ... permission deniedCREATE ROLECREATE DATABA= SEGRANT The "Could not change directory ... permission denied" part is mostly cosmetic. It happens when psql is invoked in a current working directory that the postgres user can't read. The fact that you're getting "CREATE ROLE", "CREATE DATABASE", etc command completion acknowledgements indicates that the SQL script is executing successfully anyway. So what you've showed us doesn't really indicate that anything is wrong; although you could try it from a publicly-readable starting directory if you want to be sure. regards, tom lane