Enabling use of ssh-agent from MacPorts and/or Homebrew and not the older ssh-agent that OS X ships with in /usr/bin. "description": "There's a lot of information on the intertoobs about getting ssh-agent \u0026quot working\u0026quot in OS X and even more articles about when and how the stock behavior of ssh-agent changed (mostly with respect to how ssh-agent interacted with the Keychain).\nThis article doesn't cover or care about any of that.\nThis article is concerned with:\nEnabling ssh-agent in such a way that I can \u0026quot ssh-add\u0026quot in one terminal window and that same agent (and the loaded keys) is available in all of my other terminal windows. /Users/jknight/.ssh-agent.sock - the static path to the socketĬopyright 2023 Joel Knight.-a - use a specific path to the socket, instead of coming up with a random path.-D - don't daemonize (a requirement for working with launchd) note this is different than the stock plist that uses -l which is an Apple-specific flag.The plist calls /usr/local/bin/ssh-agent with these arguments: Label -agent ProgramArguments /usr/local/bin/ssh-agent -D -a /Users/jknight/.ssh-agent.sock Sockets Listeners SockPathName /Users/jknight/.ssh-agent.sock SockPathMode 384 SockPathGroup 0 EnableTransactions I'm going to create ~/Library/LaunchAgents/ like so: In order to avoid modifying the stock OS and also due to System Integrity Protection, which prevents editing or even unloading of -agent, I'm going to leave the file alone and create a custom plist. I've reworded the article to indicate that ssh-agent will spawn immediately and also made some other minor touchups and clarifications. I'm not sure if I just got it wrong or if the behavior changed in a later point release of OS X 10.11, but I don't currently observe that behavior. Update Mar 29 2017: An earlier version of this article gave the impression that the Homebrew agent would spawn on-demand, like the stock ssh-agent. But I want to use /usr/local/bin/ssh-agent from Homebrew. If I was satisified with using /usr/bin/ssh-agent then I'd be done. Remember, this is a randomly generated path and changes every time launchd launches the -agent agent.
0 Comments
Leave a Reply. |