Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVNoe-00025a-Qy for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Aug 2023 03:00:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qVNod-000IUN-IC for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Aug 2023 03:00:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVNod-000IUF-97 for pgsql-bugs@lists.postgresql.org; Mon, 14 Aug 2023 03:00:23 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qVNob-0000Ua-BQ for pgsql-bugs@lists.postgresql.org; Mon, 14 Aug 2023 03:00:22 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3a7ca8720a0so2932465b6e.2 for ; Sun, 13 Aug 2023 20:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691982021; x=1692586821; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=T1nNpwlb9HFvCBQJbykYihL3gwWYldXJePrAI3Fdxn4=; b=drVND7scWEDMfmSigqeayjkgE8BbR+Z+uJ8KxSgePIX7nouCVvDzb71tJTRvwlJFyU U7VcC27CDDSPIfKybstr+Lah8wuJ4d2jjQ31aubQopJUGpRjmzvFjaYMy/JXdtA+Pcld Z/+QDnG3xzGtsL3PS1cxY8d7nBMFunWoHSXUB1npu4/rGSPCO1imL2eA2l0N5hdNZQQa jScERTzpXwYJWXVB9wHvEfRue4Q+F2pgUEFkUR4xJVv8H11kDei3H/wGhPMyaD4Y40Pt KlKa40FqjU40OLDSKE9U/21IZnj1MvqN7BBn/HIJjLEfiepcIgwdCok6506KJjuwXqdF Bzag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691982021; x=1692586821; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=T1nNpwlb9HFvCBQJbykYihL3gwWYldXJePrAI3Fdxn4=; b=jRyr7s02FmtHwTEqJTZ30XnXOJIUHfJ0AToj0dk0F4b2KS7RBJFdV3Tr8sLRRbCAux YNi6A1N+2tWE2fWLnaxG6YmddOZMzzRH61FMttWxwUlC23m8WttuH41vZkstSvbvvkWA yJygiueWM2AJaT99QdWECNpgJRCJmyBvRUOfyozpe3ej/TtyRur/6/6eIUXJU1rcKtiE V65Zh29gwgfWsUugfKfWTUv3gJE2CwrAVI3qw3IufySxrOQ9bSc62BEKAxmWARsS8mUw hQ20JQTmsEhiloMURoIFX3db0a8SGxe8dEi3sfuWNeUMajq/oypCxGyGawE5NQ/hsG/5 k4SA== X-Gm-Message-State: AOJu0Ywcx5TJylPzH5O+IijG7kix8V0CeDE0wHfUkkvHEV0ATxRwTifq XteaiYtByWOvFQkqlPSx7Cw= X-Google-Smtp-Source: AGHT+IEIV/NEGydhLbFFNTFXsv/YSPyR+9KSNQybW0AFH4m41R+C32SDYsceivriH7lvAx1FbRGXTg== X-Received: by 2002:a05:6808:4c5:b0:3a7:398d:d2f1 with SMTP id a5-20020a05680804c500b003a7398dd2f1mr9635117oie.49.1691982020622; Sun, 13 Aug 2023 20:00:20 -0700 (PDT) Received: from jrouhaud (2001-b011-1006-94cc-ada7-574e-efb0-5ff5.dynamic-ip6.hinet.net. [2001:b011:1006:94cc:ada7:574e:efb0:5ff5]) by smtp.gmail.com with ESMTPSA id z13-20020aa785cd000000b006815fbe3245sm6851852pfn.37.2023.08.13.20.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 20:00:19 -0700 (PDT) Date: Mon, 14 Aug 2023 11:00:14 +0800 From: Julien Rouhaud To: arasopero.1@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18054: Permission denied. Message-ID: <20230814030014.xc4pbmdlfaxvpmcg@jrouhaud> References: <18054-792b6eaac27319ad@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18054-792b6eaac27319ad@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sun, Aug 13, 2023 at 04:26:48AM +0000, PG Bug reporting form wrote: > The following bug has been logged on the website: > > I can not make backup and restoration of my db by this issues: > baap@baap-notebookpc:~$ sudo su postgres > [sudo] password for baap: > postgres@baap-notebookpc:/home/baap$ psql > could not change directory to "/home/baap": Permission denied > psql (15.4 (Ubuntu 15.4-1.pgdg22.04+1)) > > Can you help me to solve this situation? Are you talking about the "Permission denied" line? This is not a bug, just an indication that the current OS user doesn't have permission to use the given directory, and doesn't prevent you from using psql. Of course it means that the postgres OS user can't write data in /home/baap, and won't be able to e.g. save the psql history, but that's something enforced at the OS level not something postgres can change. You could either use "sudo su - postgres" to simulate a full login and therefore change the directory to postgres' home directory, then any if you try to write things using a relative path it should work, provided that the postgres OS user is correctly configured. Otherwise you need to specify absolute paths, pointing to directories where the postgres OS user have enough permissions for what you want to do.