How to solve problem with ssh authentication?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am trying to login into remote server without password using ssh but I am get the error:



Permission denied (publickey)


To copy .pub key to the server, I had:



PasswordAuthentication = yes (in the sshd_config file).


After I copied the .pub key, the i disabled the password in the ssh_config I had:



PasswordAuthentication = no


Now when I tried to ssh:



ssh 'server@192.168.xx.x'



I was getting the error:



Permission denied (publickey)


How can I solve the problem?



I have changed the authorized_keys permission, the .ssh/ permission and so on, but the problem persist. I have even used the ssh-agent $SHELL && ssh-add command.










share|improve this question























  • What are the current permissions on the .ssh directory and the files therein on the server system?
    – Kusalananda
    Sep 19 at 7:29










  • authorized_keys in remote host must be 644
    – Archemar
    Sep 19 at 7:40






  • 1




    using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
    – fcbsd
    Sep 19 at 9:18










  • How do you pass your private key? Using ssh-agent or ssh -i ?
    – Panki
    Sep 19 at 9:51










  • @Panki They say they start a shell through the agent and then add the key with ssh-add.
    – Kusalananda
    Sep 19 at 9:56














up vote
0
down vote

favorite












I am trying to login into remote server without password using ssh but I am get the error:



Permission denied (publickey)


To copy .pub key to the server, I had:



PasswordAuthentication = yes (in the sshd_config file).


After I copied the .pub key, the i disabled the password in the ssh_config I had:



PasswordAuthentication = no


Now when I tried to ssh:



ssh 'server@192.168.xx.x'



I was getting the error:



Permission denied (publickey)


How can I solve the problem?



I have changed the authorized_keys permission, the .ssh/ permission and so on, but the problem persist. I have even used the ssh-agent $SHELL && ssh-add command.










share|improve this question























  • What are the current permissions on the .ssh directory and the files therein on the server system?
    – Kusalananda
    Sep 19 at 7:29










  • authorized_keys in remote host must be 644
    – Archemar
    Sep 19 at 7:40






  • 1




    using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
    – fcbsd
    Sep 19 at 9:18










  • How do you pass your private key? Using ssh-agent or ssh -i ?
    – Panki
    Sep 19 at 9:51










  • @Panki They say they start a shell through the agent and then add the key with ssh-add.
    – Kusalananda
    Sep 19 at 9:56












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to login into remote server without password using ssh but I am get the error:



Permission denied (publickey)


To copy .pub key to the server, I had:



PasswordAuthentication = yes (in the sshd_config file).


After I copied the .pub key, the i disabled the password in the ssh_config I had:



PasswordAuthentication = no


Now when I tried to ssh:



ssh 'server@192.168.xx.x'



I was getting the error:



Permission denied (publickey)


How can I solve the problem?



I have changed the authorized_keys permission, the .ssh/ permission and so on, but the problem persist. I have even used the ssh-agent $SHELL && ssh-add command.










share|improve this question















I am trying to login into remote server without password using ssh but I am get the error:



Permission denied (publickey)


To copy .pub key to the server, I had:



PasswordAuthentication = yes (in the sshd_config file).


After I copied the .pub key, the i disabled the password in the ssh_config I had:



PasswordAuthentication = no


Now when I tried to ssh:



ssh 'server@192.168.xx.x'



I was getting the error:



Permission denied (publickey)


How can I solve the problem?



I have changed the authorized_keys permission, the .ssh/ permission and so on, but the problem persist. I have even used the ssh-agent $SHELL && ssh-add command.







ssh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 19 at 9:05









Goro

5,96652762




5,96652762










asked Sep 19 at 7:25









Taddey

1




1











  • What are the current permissions on the .ssh directory and the files therein on the server system?
    – Kusalananda
    Sep 19 at 7:29










  • authorized_keys in remote host must be 644
    – Archemar
    Sep 19 at 7:40






  • 1




    using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
    – fcbsd
    Sep 19 at 9:18










  • How do you pass your private key? Using ssh-agent or ssh -i ?
    – Panki
    Sep 19 at 9:51










  • @Panki They say they start a shell through the agent and then add the key with ssh-add.
    – Kusalananda
    Sep 19 at 9:56
















  • What are the current permissions on the .ssh directory and the files therein on the server system?
    – Kusalananda
    Sep 19 at 7:29










  • authorized_keys in remote host must be 644
    – Archemar
    Sep 19 at 7:40






  • 1




    using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
    – fcbsd
    Sep 19 at 9:18










  • How do you pass your private key? Using ssh-agent or ssh -i ?
    – Panki
    Sep 19 at 9:51










  • @Panki They say they start a shell through the agent and then add the key with ssh-add.
    – Kusalananda
    Sep 19 at 9:56















What are the current permissions on the .ssh directory and the files therein on the server system?
– Kusalananda
Sep 19 at 7:29




What are the current permissions on the .ssh directory and the files therein on the server system?
– Kusalananda
Sep 19 at 7:29












authorized_keys in remote host must be 644
– Archemar
Sep 19 at 7:40




authorized_keys in remote host must be 644
– Archemar
Sep 19 at 7:40




1




1




using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
– fcbsd
Sep 19 at 9:18




using ssh -vvv will give more verbose output - but is the .pub key in the your authorized_keys file on the server you want to access?
– fcbsd
Sep 19 at 9:18












How do you pass your private key? Using ssh-agent or ssh -i ?
– Panki
Sep 19 at 9:51




How do you pass your private key? Using ssh-agent or ssh -i ?
– Panki
Sep 19 at 9:51












@Panki They say they start a shell through the agent and then add the key with ssh-add.
– Kusalananda
Sep 19 at 9:56




@Panki They say they start a shell through the agent and then add the key with ssh-add.
– Kusalananda
Sep 19 at 9:56










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I always use below step to create new ssh connection to remote machines:




  1. Generate a new ssh key pair (just press enter until back to shell):



    localhost$ ssh-keygen -t rsa
    localhost$ cp .ssh/id_rsa.pub .ssh/authorized_keys



  2. Copying the newly created public key to remote machine:



    localhost$ ssh-copy-id username@myIP
    username@myIP password:



  3. Now try to login (there will be no password prompt):



    ssh username@myIP



Notes: I never edit ssh_config and sshd_config so maybe you can
restore them back to the original state unless they already connected.







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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f469948%2fhow-to-solve-problem-with-ssh-authentication%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I always use below step to create new ssh connection to remote machines:




    1. Generate a new ssh key pair (just press enter until back to shell):



      localhost$ ssh-keygen -t rsa
      localhost$ cp .ssh/id_rsa.pub .ssh/authorized_keys



    2. Copying the newly created public key to remote machine:



      localhost$ ssh-copy-id username@myIP
      username@myIP password:



    3. Now try to login (there will be no password prompt):



      ssh username@myIP



    Notes: I never edit ssh_config and sshd_config so maybe you can
    restore them back to the original state unless they already connected.







    share|improve this answer
























      up vote
      0
      down vote













      I always use below step to create new ssh connection to remote machines:




      1. Generate a new ssh key pair (just press enter until back to shell):



        localhost$ ssh-keygen -t rsa
        localhost$ cp .ssh/id_rsa.pub .ssh/authorized_keys



      2. Copying the newly created public key to remote machine:



        localhost$ ssh-copy-id username@myIP
        username@myIP password:



      3. Now try to login (there will be no password prompt):



        ssh username@myIP



      Notes: I never edit ssh_config and sshd_config so maybe you can
      restore them back to the original state unless they already connected.







      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        I always use below step to create new ssh connection to remote machines:




        1. Generate a new ssh key pair (just press enter until back to shell):



          localhost$ ssh-keygen -t rsa
          localhost$ cp .ssh/id_rsa.pub .ssh/authorized_keys



        2. Copying the newly created public key to remote machine:



          localhost$ ssh-copy-id username@myIP
          username@myIP password:



        3. Now try to login (there will be no password prompt):



          ssh username@myIP



        Notes: I never edit ssh_config and sshd_config so maybe you can
        restore them back to the original state unless they already connected.







        share|improve this answer












        I always use below step to create new ssh connection to remote machines:




        1. Generate a new ssh key pair (just press enter until back to shell):



          localhost$ ssh-keygen -t rsa
          localhost$ cp .ssh/id_rsa.pub .ssh/authorized_keys



        2. Copying the newly created public key to remote machine:



          localhost$ ssh-copy-id username@myIP
          username@myIP password:



        3. Now try to login (there will be no password prompt):



          ssh username@myIP



        Notes: I never edit ssh_config and sshd_config so maybe you can
        restore them back to the original state unless they already connected.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 19 at 13:50









        affan

        274




        274



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f469948%2fhow-to-solve-problem-with-ssh-authentication%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            The Forum (Inglewood, California)

            Palaiologos