Installed cron `keymaker-group-sync` fails on adding user to group
See original GitHub issueThe automatically installed cron /etc/cron.d/keymaker-group-sync
fails when it needs to add a user to a group:
INFO:keymaker:Syncing IAM group keymaker_mynewgroup
WARNING:keymaker:User myuser1 is not provisioned or not managed by keymaker, skipping
INFO:keymaker:Adding user myuser2 to group sudo
Traceback (most recent call last):
File "/usr/local/bin/keymaker", line 89, in <module>
locals()[args.command](args)
File "/usr/local/lib/python2.7/dist-packages/keymaker/__init__.py", line 240, in sync_groups
subprocess.check_call(["usermod", "--append", "--groups", unix_group_name, user])
File "/usr/lib/python2.7/subprocess.py", line 535, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Problem is that the $PATH variable is not set. Current solution is to set the variable manually (used /etc/environment):
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
*/5 * * * * root /usr/local/bin/keymaker sync_groups
The cron would have probably also failed on the other commands used by sync_groups: groupadd
and gpasswd
. By setting the PATH these commands should work as well.
My environment details: Keymaker: 0.4.3 Distribution: Ubuntu 14.04.5 LTS Kernel: Linux 3.13.0-112-generic #159-Ubuntu
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why is my crontab not working, and how can I troubleshoot it?
Edit your crontab; go to the end of the line which contains the last command and insert a new line (press enter). Check...
Read more >Crontab error: no crontab For [user] - Unix Stack Exchange
It turns out the actual root cause of the problem was that I was using ctrl+z to close nano (sends process to background)...
Read more >IJ37076: USER LICENSE TYPE CHANGED FROM ... - IBM
PROBLEM DESCRIPTION: To an Express Concurrent user, Adding READ access to AWADMIN application incorrectly changes the user to CONCURRENT.
Read more >Controlling Access to the crontab Command
Controlling Access to the crontab Command. You can control access to the crontab command by using two files in the /etc/cron.d directory: cron.deny...
Read more >How To Use Cron to Automate Tasks on Ubuntu 18.04
To schedule a job, open up your crontab for editing and add a task written in the form of a cron expression. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same situation on Ubuntu 18.04
Sorry I didn’t respond earlier. This problem can be reproduced using a stock Ubuntu 18.04 AMI in EC2, i.e. those provided by Canonical here: https://cloud-images.ubuntu.com/locator/ec2/.