Changes between Version 1 and Version 2 of Ticket #13049


Ignore:
Timestamp:
Jan 29, 2024, 12:58:16 PM (7 months ago)
Author:
kataba
Comment:

Additional information

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13049 – Description

    v1 v2  
    1 IMPORTANT EDIT:
    2 I've found that the actual reason for FileZilla failing to use the keys loaded in ssh-agent is that FileZilla starts its own ssh-agent process with its own socket instead of using the default one where the keys are loaded. The default socket location is in a temporary directory /var/folders/sm/4bt9kz951dg4s5kq1jwy57tc0000gn/T//ssh-nWola5Puaw6o/agent.2855, and when I start FileZilla, it creates its own at /private/tmp/com.apple.launchd.YiC62e7kHT/Listeners.
    3 
    4 
    51I recently set up SSH access to my web servers on my Mac by following GitHub's documentation for Generating a new SSH key and adding it to the ssh-agent. After that, I installed FileZilla and the connections to my servers worked correctly. However, today I restarted my Mac, and tried to connect via SSH using the terminal, it asked me for the passphrase of my private key. I entered it and could connect. However, I still couldn't connect to my servers via SFTP on FileZilla. I tried running eval "$(ssh-agent -s)" and ssh-add --apple-use-keychain ~/.ssh/id_ed25519, but this did not help. I am either getting in FileZilla:
    62
     
    2622
    2723Removing FileZila preferences, removing the app and reinstalling it did not help.
     24
     25Edit 1:
     26I've found that the actual reason for FileZilla failing to use the keys loaded in ssh-agent is that FileZilla starts its own ssh-agent process with its own socket instead of using the default one where the keys are loaded. The default socket location is in a temporary directory /var/folders/sm/4bt9kz951dg4s5kq1jwy57tc0000gn/T//ssh-nWola5Puaw6o/agent.2855, and when I try to use SFTP via FileZilla, it creates its own at /private/tmp/com.apple.launchd.YiC62e7kHT/Listeners.
     27
     28Update:
     29
     30I use ohmyzsh with a couple common plugins. I found out I had the ssh-agent plugin enabled. After disabling it, it stopped asking me for passphrase, but also ssh-agent doesn't get started when I open my terminal. When I add my keys it doesn't ask me for a passphrase, which by itself is what I would expect, based on my config. I am still not sure what caused the bad passhphrase error though.
     31
     32With the ssh-plugin plugin disabled, when I boot/restart my system, an ssh-agent doesn't get started on boot (I think it's like that by default; the ssh-agent plugin didn't change this, it was only responsible for automatically starting an ssh-agent when I open my terminal). Then I open my terminal. Then when I run the `ssh` command to ssh into a server, automatically an ssh-agent gets started and my private key gets imported without asking for a passphrase. I hope this is how it should work based on my config.
     33
     34By default, there is an environment variable `$SSH_AUTH_SOCK` set to a temp folder location and `$SSH_AGENT_PID` is empty. The ssh-plugin was starting a new ssh-agent instance and overwriting the `$SSH_AUTH_SOCK` variable to its own socket, and this way shadowing the existing ssh-agent instance that used the default socket location (if there is one running), and this led to two different ssh-agent instances running at the same time and listening on different sockets.