TransWikia.com

How to change ssh agent unix socket location on server side

Unix & Linux Asked by aisbaa on February 13, 2021

When I connect to the remote machine SSH_AUTH_SOCK gets set to /tmp/ssh-RANDOM_HASH/agent.PID. Is it possible to configure sshd to use different location for SSH_AUTH_SOCK. I would like to use /tmp/ssh/RANDOM_HASH/agent.PID instead.

2 Answers

I dug a little in the code and found that path pattern (auth_sock_dir) is hardcoded and the function (auth_input_request_forwarding) is marked as static. So theres is no way to set a different pattern in config and there is no way to preload a different function.

Correct answer by aisbaa on February 13, 2021

It is actually ssh-agent that sets the SSH_AUTH_SOCKET environment variable. You can use the -a option when you start ssh-agent to put the socket somewhere other than the default (and SSH_AUTH_SOCK will be set accordingly). However, the pattern that is used to construct the socket name is hardcoded, and you won't be able to change the default location without modifying the ssh-agent source code.

Answered by patbarron on February 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP