1

What's the proper way to configure sudo to keep the SSH_AUTH_SOCK environment variable?

I was following some guide on the Internet, but it is not working for me:

$ printenv | grep SSH
SSH_AUTH_SOCK=/tmp/ssh-Zy2v8uDtJxPw/agent.2628
SSH_AGENT_PID=2629

$ sudo printenv | grep SSH | wc 
      0       0       0

I thought I need to restart sudo service, but How To Restart Sudo Service on Ubuntu 16.10 says no need.

xpt
  • 1,197

1 Answers1

2
sudo -E printenv | grep SSH

-E Preserves your environment variables into the sudo.

Eliah Kagan
  • 119,640