0

So I've seen this question and added the Defaults env_keep+=SSH_AUTH_SOCK into my /etc/sudoers file but I am still unable to clone from github on my Vagrant box using sudo: true and sudo_user: <user> in my ansible playbook. I'd like to clone the code as the user I created to run it but it is proving to be really frustrating. I can do ssh git@github.com when I log in via vagrant ssh but when I then do sudo -u <user> ssh git@github.com I get the Permission Denied error. When I echo the SSH_AUTH_SOCK value as the specific user I see that it is set:

vagrant@vagrant-ubuntu-trusty-64:/tmp$ sudo -u derp echo $SSH_AUTH_SOCK
/tmp/ssh-w3XYbqlMnX/agent.1592
MattC
  • 377
  • 1
  • 4
  • 11

1 Answers1

3

I think the issue is the /tmp file doesn't have permissions. If you

 sudo -u root ssh git@github.com

That might work since root can read the files

To fix this as the vagrant user run

setfacl -m otheruser:x   $(dirname "$SSH_AUTH_SOCK")
setfacl -m otheruser:rwx "$SSH_AUTH_SOCK"

That should give the otheruser rights to get into the directory and read the file.

Mike
  • 22,310
  • 7
  • 56
  • 79