I have a ssh only user account called pgbackrest with disabled password .
I have created a directory /etc/pgbackrest/ as root (sudo mkdir -p /etc/pgbackrest). Then I create a config file under the above directory and changed the ownership to the account pgbackrest and sudo chmod 640 /etc/pgbackrest/pgbackrest.conf
When I try to edit it with
- Switch to
pgbackrestusersudo su - pgbackrestandvim /etc/pgbackrest/pgbackrest.conf, I get/etc/pgbackrest/pgbackrest.conf" [Permission Denied]in the vim editor. sudo -u pgbackrest vim /etc/pgbackrest/pgbackrest.conf, I get/etc/pgbackrest/pgbackrest.conf" [Permission Denied]in the vim editor.
does the permissions on the upper level directory prohibit the edit ? 640 means the owner and the group members can read, write. I am accessing the file as the owner, why am I getting access denied ?
pgbackrestuser has to be able to have at leastxpermissions to the directory. To get a listing then it also needsr. And to create files (eg temp files) it also needsw. So, yes, directory permissions matter.drwxr-x--- 3 root root 4096 Aug 10 22:56 pgbackreston the file-rw-r----- 1 pgbackrest pgbackrest 0 Aug 10 01:12 pgbackrest.conf. Is it a good idea to own the/etc/pgbackrestto pgbackrest user ? considering the fact that it is under a system directory.chmod a+x /etc/pgbackrestso that anyone can see files they have permission to in that directory... if they know the name.