Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not write to /etc/cron.d #59

Open
yerrysherry opened this issue Dec 17, 2017 · 4 comments
Open

Can not write to /etc/cron.d #59

yerrysherry opened this issue Dec 17, 2017 · 4 comments

Comments

@yerrysherry
Copy link

Hallo,

After changing the backup directory to /export (update_pgsql_node_config) and restarting the daemons, pgbackman refused to create the con file. I think, he tries to create it with his user name instead of root.

2017-12-17 22:06:19,180 [pgbackman_control][22294][INFO]: UID: 999 abd GID: 999 defined for the directory /export/pgsql_node_3/log
2017-12-17 22:06:19,187 [pgbackman_control][22294][ERROR]: Problems creating/updating the crontab file: /etc/cron.d/pgsql_node_3 - [Errno 13] Permission denied: u'/etc/cron.d/pgsql_node_3'
2017-12-17 22:06:19,200 [pgbackman_control][22294][ERROR]: Problems creating/updating the crontab file: /etc/cron.d/pgsql_node_3 - [Errno 13] Permission denied: u'/etc/cron.d/pgsql_node_3'

Regards,
Gerrit

@yerrysherry
Copy link
Author

Hallo,

root@pgbackman:/etc/cron.d# cd /etc
root@pgbackman:/etc# chmod 777 cron.d
root@pgbackman:/etc# cd /etc/cron.d
root@pgbackman:/etc/cron.d# ls
mdadm pgsql_node_1 pgsql_node_3 popularity-contest sysstat
root@pgbackman:/etc/cron.d# ls -l
total 20
-rw-r--r-- 1 root root 589 Jul 16 2014 mdadm
-rw-r--r-- 1 root root 573 Dec 17 17:05 pgsql_node_1
-rw-r--r-- 1 pgbackman pgbackman 819 Dec 17 22:23 pgsql_node_3
-rw-r--r-- 1 root root 190 Dec 12 14:23 popularity-contest
-rw-r--r-- 1 root root 396 Jan 27 2016 sysstat

Regards,
Gerrit

@ng-pe
Copy link

ng-pe commented Dec 20, 2017

Hello,
using "chmod 777 /etc/cron. d" is a bad idea:
Any user of the server can create a job under any user.
Maybe an "interim" solution would be to change the group?

chown root:pgbackman /etc/cron.d
chmod 774 /etc/cron.d

It's not perfect, but it seems less permissive to me.
Yours sincerely,

@yerrysherry
Copy link
Author

Indeed, but the owner and group of the scripts in /etc/cron.d must be root for executing the scripts. If not the scripts fail to execute. The problem is that the daemon runs as pgbackman and when he wants to write in /etc/cron.d, the daemon must have root permissions to do it.

@rafaelma rafaelma self-assigned this Dec 30, 2017
@rafaelma
Copy link
Owner

Hello, thank you for your feedback.

This is a bug in the systemd configuration files used by pgbackman. They define user and group as pgbackman and they should be root. As ng-pe says, it is not a good idea to use chmod 777 on /etc/cron.d

This is an error in the test procedure that we will try to improve.
regards,
Rafael Martinez Guerrero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants