Skip to content

Forward SSH Agent with Sudo

Allowing the ssh-agent being forwarded when using the sudo command.

Edit Configuration File for Sudo

Append the following to the file /etc/sudoers. Better create a file env_keep in /etc/sudoers.d/.

# Pass SSH socket on sudo command.
Defaults env_keep+=SSH_AUTH_SOCK