ssh-add returns with: “Error connecting to agent: No such file or directory”











up vote
4
down vote

favorite
1












ssh-add alone is not working:



Error connecting to agent: No such file or directory


How should I use that tool?










share|improve this question




















  • 1




    Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
    – Wong Jia Hau
    Aug 24 at 7:45












  • I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
    – Panki
    Aug 24 at 7:56






  • 1




    @Panki I tried that solution, it doesn't work, so I came to ask a new question.
    – Wong Jia Hau
    Aug 24 at 8:01






  • 1




    Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
    – Rui F Ribeiro
    Aug 24 at 8:07






  • 1




    Thank you for all the moderators who helped me to improve this questions!
    – Wong Jia Hau
    Aug 24 at 12:27















up vote
4
down vote

favorite
1












ssh-add alone is not working:



Error connecting to agent: No such file or directory


How should I use that tool?










share|improve this question




















  • 1




    Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
    – Wong Jia Hau
    Aug 24 at 7:45












  • I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
    – Panki
    Aug 24 at 7:56






  • 1




    @Panki I tried that solution, it doesn't work, so I came to ask a new question.
    – Wong Jia Hau
    Aug 24 at 8:01






  • 1




    Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
    – Rui F Ribeiro
    Aug 24 at 8:07






  • 1




    Thank you for all the moderators who helped me to improve this questions!
    – Wong Jia Hau
    Aug 24 at 12:27













up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





ssh-add alone is not working:



Error connecting to agent: No such file or directory


How should I use that tool?










share|improve this question















ssh-add alone is not working:



Error connecting to agent: No such file or directory


How should I use that tool?







linux ssh ssh-agent






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 24 at 11:27









Jeff Schaller

36.2k952119




36.2k952119










asked Aug 24 at 7:28









Wong Jia Hau

1295




1295








  • 1




    Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
    – Wong Jia Hau
    Aug 24 at 7:45












  • I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
    – Panki
    Aug 24 at 7:56






  • 1




    @Panki I tried that solution, it doesn't work, so I came to ask a new question.
    – Wong Jia Hau
    Aug 24 at 8:01






  • 1




    Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
    – Rui F Ribeiro
    Aug 24 at 8:07






  • 1




    Thank you for all the moderators who helped me to improve this questions!
    – Wong Jia Hau
    Aug 24 at 12:27














  • 1




    Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
    – Wong Jia Hau
    Aug 24 at 7:45












  • I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
    – Panki
    Aug 24 at 7:56






  • 1




    @Panki I tried that solution, it doesn't work, so I came to ask a new question.
    – Wong Jia Hau
    Aug 24 at 8:01






  • 1




    Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
    – Rui F Ribeiro
    Aug 24 at 8:07






  • 1




    Thank you for all the moderators who helped me to improve this questions!
    – Wong Jia Hau
    Aug 24 at 12:27








1




1




Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
– Wong Jia Hau
Aug 24 at 7:45






Dear moderators, I was ask to moved this question to this site from StackOverflow, but then I got downvote again? Can you at least tell me why?
– Wong Jia Hau
Aug 24 at 7:45














I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
– Panki
Aug 24 at 7:56




I'm not a moderator, but simply googling the error message would have given you an answer. stackoverflow.com/questions/17846529/…
– Panki
Aug 24 at 7:56




1




1




@Panki I tried that solution, it doesn't work, so I came to ask a new question.
– Wong Jia Hau
Aug 24 at 8:01




@Panki I tried that solution, it doesn't work, so I came to ask a new question.
– Wong Jia Hau
Aug 24 at 8:01




1




1




Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
– Rui F Ribeiro
Aug 24 at 8:07




Please read our FAQ, take the tour and lurk for a while to get a feel of the forum use.
– Rui F Ribeiro
Aug 24 at 8:07




1




1




Thank you for all the moderators who helped me to improve this questions!
– Wong Jia Hau
Aug 24 at 12:27




Thank you for all the moderators who helped me to improve this questions!
– Wong Jia Hau
Aug 24 at 12:27










3 Answers
3






active

oldest

votes

















up vote
8
down vote



accepted










You need to initialize the agent first.



ssh-agent bash





share|improve this answer

















  • 2




    Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
    – Wong Jia Hau
    Aug 24 at 7:43


















up vote
4
down vote













The SSH agent is not running, or the environment variables that it sets are not available in the current environment (most importantly SSH_AUTH_SOCK), or they are set incorrectly (pointing to a dead agent).



You could start the agent in the current shell session using



eval "$(ssh-agent)"


or start a new shell session through the agent using



ssh-agent fish


But since you say that you used to be able to use ssh-add without this, it leads me to believe that you've accidentally killed the agent (or it has terminated due to some other reason). The error message makes me think that the SSH_AUTH_SOCK environment variable is actually set, but that ssh-add can't find a valid communication socket at that path.



It would not surprise me if your usual way of doing things would work again if you completely logged out and logged in again, or rebooted the machine.






share|improve this answer























  • Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
    – Wong Jia Hau
    Aug 24 at 8:26


















up vote
0
down vote













In windows power shell:




  1. Check the current status of ssh-agent: "Get-Service | select -property name,starttype"

  2. Set the new type : "Set-Service -Name ssh-agent -StartupType Manual"

  3. Start it: "Start-Service ssh-agent"

  4. Add your key as before: "ssh-add"






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464574%2fssh-add-returns-with-error-connecting-to-agent-no-such-file-or-directory%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    8
    down vote



    accepted










    You need to initialize the agent first.



    ssh-agent bash





    share|improve this answer

















    • 2




      Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
      – Wong Jia Hau
      Aug 24 at 7:43















    up vote
    8
    down vote



    accepted










    You need to initialize the agent first.



    ssh-agent bash





    share|improve this answer

















    • 2




      Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
      – Wong Jia Hau
      Aug 24 at 7:43













    up vote
    8
    down vote



    accepted







    up vote
    8
    down vote



    accepted






    You need to initialize the agent first.



    ssh-agent bash





    share|improve this answer












    You need to initialize the agent first.



    ssh-agent bash






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 24 at 7:41









    Panki

    42719




    42719








    • 2




      Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
      – Wong Jia Hau
      Aug 24 at 7:43














    • 2




      Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
      – Wong Jia Hau
      Aug 24 at 7:43








    2




    2




    Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
    – Wong Jia Hau
    Aug 24 at 7:43




    Thanks it works for me! Since I'm using fish, the command is ssh-agent fish.
    – Wong Jia Hau
    Aug 24 at 7:43












    up vote
    4
    down vote













    The SSH agent is not running, or the environment variables that it sets are not available in the current environment (most importantly SSH_AUTH_SOCK), or they are set incorrectly (pointing to a dead agent).



    You could start the agent in the current shell session using



    eval "$(ssh-agent)"


    or start a new shell session through the agent using



    ssh-agent fish


    But since you say that you used to be able to use ssh-add without this, it leads me to believe that you've accidentally killed the agent (or it has terminated due to some other reason). The error message makes me think that the SSH_AUTH_SOCK environment variable is actually set, but that ssh-add can't find a valid communication socket at that path.



    It would not surprise me if your usual way of doing things would work again if you completely logged out and logged in again, or rebooted the machine.






    share|improve this answer























    • Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
      – Wong Jia Hau
      Aug 24 at 8:26















    up vote
    4
    down vote













    The SSH agent is not running, or the environment variables that it sets are not available in the current environment (most importantly SSH_AUTH_SOCK), or they are set incorrectly (pointing to a dead agent).



    You could start the agent in the current shell session using



    eval "$(ssh-agent)"


    or start a new shell session through the agent using



    ssh-agent fish


    But since you say that you used to be able to use ssh-add without this, it leads me to believe that you've accidentally killed the agent (or it has terminated due to some other reason). The error message makes me think that the SSH_AUTH_SOCK environment variable is actually set, but that ssh-add can't find a valid communication socket at that path.



    It would not surprise me if your usual way of doing things would work again if you completely logged out and logged in again, or rebooted the machine.






    share|improve this answer























    • Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
      – Wong Jia Hau
      Aug 24 at 8:26













    up vote
    4
    down vote










    up vote
    4
    down vote









    The SSH agent is not running, or the environment variables that it sets are not available in the current environment (most importantly SSH_AUTH_SOCK), or they are set incorrectly (pointing to a dead agent).



    You could start the agent in the current shell session using



    eval "$(ssh-agent)"


    or start a new shell session through the agent using



    ssh-agent fish


    But since you say that you used to be able to use ssh-add without this, it leads me to believe that you've accidentally killed the agent (or it has terminated due to some other reason). The error message makes me think that the SSH_AUTH_SOCK environment variable is actually set, but that ssh-add can't find a valid communication socket at that path.



    It would not surprise me if your usual way of doing things would work again if you completely logged out and logged in again, or rebooted the machine.






    share|improve this answer














    The SSH agent is not running, or the environment variables that it sets are not available in the current environment (most importantly SSH_AUTH_SOCK), or they are set incorrectly (pointing to a dead agent).



    You could start the agent in the current shell session using



    eval "$(ssh-agent)"


    or start a new shell session through the agent using



    ssh-agent fish


    But since you say that you used to be able to use ssh-add without this, it leads me to believe that you've accidentally killed the agent (or it has terminated due to some other reason). The error message makes me think that the SSH_AUTH_SOCK environment variable is actually set, but that ssh-add can't find a valid communication socket at that path.



    It would not surprise me if your usual way of doing things would work again if you completely logged out and logged in again, or rebooted the machine.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 2 days ago

























    answered Aug 24 at 7:52









    Kusalananda

    116k15218352




    116k15218352












    • Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
      – Wong Jia Hau
      Aug 24 at 8:26


















    • Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
      – Wong Jia Hau
      Aug 24 at 8:26
















    Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
    – Wong Jia Hau
    Aug 24 at 8:26




    Yes, I think I killed the agent accidentally, perhaps due to restarting the machine.
    – Wong Jia Hau
    Aug 24 at 8:26










    up vote
    0
    down vote













    In windows power shell:




    1. Check the current status of ssh-agent: "Get-Service | select -property name,starttype"

    2. Set the new type : "Set-Service -Name ssh-agent -StartupType Manual"

    3. Start it: "Start-Service ssh-agent"

    4. Add your key as before: "ssh-add"






    share|improve this answer



























      up vote
      0
      down vote













      In windows power shell:




      1. Check the current status of ssh-agent: "Get-Service | select -property name,starttype"

      2. Set the new type : "Set-Service -Name ssh-agent -StartupType Manual"

      3. Start it: "Start-Service ssh-agent"

      4. Add your key as before: "ssh-add"






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        In windows power shell:




        1. Check the current status of ssh-agent: "Get-Service | select -property name,starttype"

        2. Set the new type : "Set-Service -Name ssh-agent -StartupType Manual"

        3. Start it: "Start-Service ssh-agent"

        4. Add your key as before: "ssh-add"






        share|improve this answer














        In windows power shell:




        1. Check the current status of ssh-agent: "Get-Service | select -property name,starttype"

        2. Set the new type : "Set-Service -Name ssh-agent -StartupType Manual"

        3. Start it: "Start-Service ssh-agent"

        4. Add your key as before: "ssh-add"







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 16 at 16:57









        Jeff Schaller

        36.2k952119




        36.2k952119










        answered Oct 16 at 16:27









        Chris

        1




        1






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464574%2fssh-add-returns-with-error-connecting-to-agent-no-such-file-or-directory%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt