-
-
Notifications
You must be signed in to change notification settings - Fork 287
Users gets deleted when cron job runs import_users.sh #69
Comments
hum, strange. I have been using this code in production for a couple of months now and never saw what you describe here. Can you check your server's logfiles for lines |
I think its my bad, I did the configuration manually without running install.sh script and it works. I will close this issue. |
This happened for me as well on Ubuntu 16.04 LTS; I think it's environmental. The environment that cron runs in is: But the
|
I think the problem is that this solution is not intended to work with Ubuntu. The demo uses Amazon Linux https://github.com/widdix/aws-ec2-ssh#demo-with-cloudformation and also our tests (https://github.com/widdix/aws-ec2-ssh/tree/master/test) use Amazon Linux only. Is anyone interested in fixing all the Ubuntu issues? I'm not using Ubuntu at all. I'm an Amazon Linux user. |
I'm also not using Ubuntu, only Amazon Linux. So to confirm for me:
The thing about the PATH is a good one. On amazon linux the aws binary is in /usr/bin/aws so this could be the issue yes. If it's not in the current PATH, we cannot use which or whereis to find the location. |
I believe, if we change
it should work. |
Clearly you had your wake-up coffee, where I didn't. |
☕️ |
I installed aws-ec2-ssh on an ubuntu 16.04 server running on aws. The import_users.sh script imports the users from aws iam and setup the user environment. But after 10 minutes when the cron job runs the script again, it removes all the users imported. I have also noticed that, it doesn't remove local users created by me, as it should be.
I think the problem exist in the following code:
iam_users=$(get_clean_iam_users | sort | uniq)
sudo_users=$(get_clean_sudoers_users | sort | uniq)
local_users=$(get_local_users | sort | uniq)
intersection=$(echo ${local_users} ${iam_users} | tr " " "\n" | sort | uniq -D | uniq)
removed_users=$(echo ${local_users} ${intersection} | tr " " "\n" | sort | uniq -u)
The text was updated successfully, but these errors were encountered: