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

SSH_AUTH_SOCK is not set when running cron jobs #128

Open
alexander-danilenko opened this issue Jul 9, 2019 · 0 comments
Open

SSH_AUTH_SOCK is not set when running cron jobs #128

alexander-danilenko opened this issue Jul 9, 2019 · 0 comments

Comments

@alexander-danilenko
Copy link

alexander-danilenko commented Jul 9, 2019

Description

I've configured crontab as per documentation, but when I'm trying to connect to any SSH inside my cron job it fails on access denied (public key) error.

Steps to reproduce:

  1. touch ./docksal/services/cli/crontab
  2. Add following to recently created file:
    * * * * * bash -lc 'env >> /tmp/cron-test.log 2>&1'
    
  3. fin reset cli

Result: once cron will run it will write current environment variables to /tmp/cron-test.log file and there is no SSH_AUTH_SOCK which indicates what ssh keys (what socket) should be used.
Expected behavior: SSH_AUTH_SOCK should be available in crontab job.

Temporary solution:

For me just adding SSH_AUTH_SOCK environment variable at the very beginning of crontab file helped. So following works good and i'm getting no ssh errors with this trick.

.docksal/services/cli/crontab content:

SSH_AUTH_SOCK=/.ssh-agent/proxy-socket
* * * * * bash -lc 'env >> /tmp/cron-test.log 2>&1'

I believe it should be either documented here or automated.

Thanks!

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

2 participants