SSH Permission denied (using right password)SSH asks for passwordssh always prompts for key...

Elements other than carbon that can form many different compounds by bonding to themselves?

How to denote matrix elements succinctly?

Can someone publish a story that happened to you?

What happens to Mjolnir (Thor's hammer) at the end of Endgame?

How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?

Relationship between strut and baselineskip

Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?

Providing evidence of Consent of Parents for Marriage by minor in England in early 1800s?

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

Pre-plastic human skin alternative

Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?

A Paper Record is What I Hamper

A strange hotel

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

Multiple options vs single option UI

How to not starve gigantic beasts

What happened to Captain America in Endgame?

What is the philosophical significance of speech acts/implicature?

How do I reattach a shelf to the wall when it ripped out of the wall?

Can I criticise the more senior developers around me for not writing clean code?

How to fry ground beef so it is well-browned

How does Captain America channel this power?

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?

acheter à, to mean both "from" and "for"?



SSH Permission denied (using right password)


SSH asks for passwordssh always prompts for key passwordPasswordless ssh cannot accept the keyGithub ask for Username & password after Configure ssh?ssh connection fails with and without rsa keysNot able to ssh for instance created by devstackPermission denied (publickey) error right after generating the SSH keysPermission denied via ssh accessPublic key authentication Permission denied (publickey)Ubuntu 16.04.2 - Connection reset by peer when ssh right after reboot






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I am having troubles setting an ssh connection between two laptops of mine. I tried different solutions posted on-line, but nothing worked. Since I am pretty new with SSH, I might be missing something important. I am using Ubuntu 14.04 LTS on the client, and Ubuntu 16.04 LTS on the server.



Here are the steps that I followed:



On the client:





  • Specified host configuration options in ~/.ssh/config:



    Host [hostname]



      User [username]
    Hostname [IP address of host]
    ServerAliveInterval 10


  • Generated RSA key by running:



ssh-keygen -t rsa -b 4096 -o -a 100




  • I supplied a password to ssh-keygen. Private key was saved in ~/.ssh/id_rsa, whereas public key was saved in ~/.ssh/id_rsa.pub


  • I manually copied ~/.ssh/id_rsa.pub to a USB key.


  • At this point, file modes are as follows:



In ~/.ssh:



   -rw-rw-r--    config
-rw------- id_rsa
-rw-r--r-- id_rsa.pub


On the server:




  • installed openssh-server;


  • created a new file ~/.ssh/authorized_keys by doing as follows



cat /media/daniele/disk/id_rsa.pub >> ~/.ssh/authorized_keys




  • set file mode of ~/.ssh/authorized_keys to


-rw-rw-r--




  • manually edited /etc/ssh/sshd_config to have


in /etc/ssh/sshd_config



RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication yes


Finally, on the client, when I try:



ssh [username]@[hostname]


the server asks for the password



[username]@[hostname]'s password:


but, even if I enter the correct one, the server does not accept it:



Permission denied, please try again


and, after three attempts, it closes the connection. Please find here a more descriptive output I get by using



ssh -v -v -v [username]@[hostname]


Any help would be greatly appreciated.



Thank you very much for your time










share|improve this question
















bumped to the homepage by Community 17 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

    – steeldriver
    Aug 1 '17 at 14:04











  • Thank you @steeldriver, but that did not work

    – Daniele Prada
    Aug 1 '17 at 14:28













  • Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

    – steeldriver
    Aug 1 '17 at 14:42











  • Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

    – Daniele Prada
    Aug 1 '17 at 14:54











  • If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

    – Daniele Prada
    Aug 1 '17 at 15:08




















3















I am having troubles setting an ssh connection between two laptops of mine. I tried different solutions posted on-line, but nothing worked. Since I am pretty new with SSH, I might be missing something important. I am using Ubuntu 14.04 LTS on the client, and Ubuntu 16.04 LTS on the server.



Here are the steps that I followed:



On the client:





  • Specified host configuration options in ~/.ssh/config:



    Host [hostname]



      User [username]
    Hostname [IP address of host]
    ServerAliveInterval 10


  • Generated RSA key by running:



ssh-keygen -t rsa -b 4096 -o -a 100




  • I supplied a password to ssh-keygen. Private key was saved in ~/.ssh/id_rsa, whereas public key was saved in ~/.ssh/id_rsa.pub


  • I manually copied ~/.ssh/id_rsa.pub to a USB key.


  • At this point, file modes are as follows:



In ~/.ssh:



   -rw-rw-r--    config
-rw------- id_rsa
-rw-r--r-- id_rsa.pub


On the server:




  • installed openssh-server;


  • created a new file ~/.ssh/authorized_keys by doing as follows



cat /media/daniele/disk/id_rsa.pub >> ~/.ssh/authorized_keys




  • set file mode of ~/.ssh/authorized_keys to


-rw-rw-r--




  • manually edited /etc/ssh/sshd_config to have


in /etc/ssh/sshd_config



RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication yes


Finally, on the client, when I try:



ssh [username]@[hostname]


the server asks for the password



[username]@[hostname]'s password:


but, even if I enter the correct one, the server does not accept it:



Permission denied, please try again


and, after three attempts, it closes the connection. Please find here a more descriptive output I get by using



ssh -v -v -v [username]@[hostname]


Any help would be greatly appreciated.



Thank you very much for your time










share|improve this question
















bumped to the homepage by Community 17 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

    – steeldriver
    Aug 1 '17 at 14:04











  • Thank you @steeldriver, but that did not work

    – Daniele Prada
    Aug 1 '17 at 14:28













  • Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

    – steeldriver
    Aug 1 '17 at 14:42











  • Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

    – Daniele Prada
    Aug 1 '17 at 14:54











  • If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

    – Daniele Prada
    Aug 1 '17 at 15:08
















3












3








3








I am having troubles setting an ssh connection between two laptops of mine. I tried different solutions posted on-line, but nothing worked. Since I am pretty new with SSH, I might be missing something important. I am using Ubuntu 14.04 LTS on the client, and Ubuntu 16.04 LTS on the server.



Here are the steps that I followed:



On the client:





  • Specified host configuration options in ~/.ssh/config:



    Host [hostname]



      User [username]
    Hostname [IP address of host]
    ServerAliveInterval 10


  • Generated RSA key by running:



ssh-keygen -t rsa -b 4096 -o -a 100




  • I supplied a password to ssh-keygen. Private key was saved in ~/.ssh/id_rsa, whereas public key was saved in ~/.ssh/id_rsa.pub


  • I manually copied ~/.ssh/id_rsa.pub to a USB key.


  • At this point, file modes are as follows:



In ~/.ssh:



   -rw-rw-r--    config
-rw------- id_rsa
-rw-r--r-- id_rsa.pub


On the server:




  • installed openssh-server;


  • created a new file ~/.ssh/authorized_keys by doing as follows



cat /media/daniele/disk/id_rsa.pub >> ~/.ssh/authorized_keys




  • set file mode of ~/.ssh/authorized_keys to


-rw-rw-r--




  • manually edited /etc/ssh/sshd_config to have


in /etc/ssh/sshd_config



RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication yes


Finally, on the client, when I try:



ssh [username]@[hostname]


the server asks for the password



[username]@[hostname]'s password:


but, even if I enter the correct one, the server does not accept it:



Permission denied, please try again


and, after three attempts, it closes the connection. Please find here a more descriptive output I get by using



ssh -v -v -v [username]@[hostname]


Any help would be greatly appreciated.



Thank you very much for your time










share|improve this question
















I am having troubles setting an ssh connection between two laptops of mine. I tried different solutions posted on-line, but nothing worked. Since I am pretty new with SSH, I might be missing something important. I am using Ubuntu 14.04 LTS on the client, and Ubuntu 16.04 LTS on the server.



Here are the steps that I followed:



On the client:





  • Specified host configuration options in ~/.ssh/config:



    Host [hostname]



      User [username]
    Hostname [IP address of host]
    ServerAliveInterval 10


  • Generated RSA key by running:



ssh-keygen -t rsa -b 4096 -o -a 100




  • I supplied a password to ssh-keygen. Private key was saved in ~/.ssh/id_rsa, whereas public key was saved in ~/.ssh/id_rsa.pub


  • I manually copied ~/.ssh/id_rsa.pub to a USB key.


  • At this point, file modes are as follows:



In ~/.ssh:



   -rw-rw-r--    config
-rw------- id_rsa
-rw-r--r-- id_rsa.pub


On the server:




  • installed openssh-server;


  • created a new file ~/.ssh/authorized_keys by doing as follows



cat /media/daniele/disk/id_rsa.pub >> ~/.ssh/authorized_keys




  • set file mode of ~/.ssh/authorized_keys to


-rw-rw-r--




  • manually edited /etc/ssh/sshd_config to have


in /etc/ssh/sshd_config



RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication yes


Finally, on the client, when I try:



ssh [username]@[hostname]


the server asks for the password



[username]@[hostname]'s password:


but, even if I enter the correct one, the server does not accept it:



Permission denied, please try again


and, after three attempts, it closes the connection. Please find here a more descriptive output I get by using



ssh -v -v -v [username]@[hostname]


Any help would be greatly appreciated.



Thank you very much for your time







server permissions ssh password






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 1 '17 at 14:58







Daniele Prada

















asked Aug 1 '17 at 13:59









Daniele PradaDaniele Prada

16114




16114





bumped to the homepage by Community 17 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 17 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

    – steeldriver
    Aug 1 '17 at 14:04











  • Thank you @steeldriver, but that did not work

    – Daniele Prada
    Aug 1 '17 at 14:28













  • Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

    – steeldriver
    Aug 1 '17 at 14:42











  • Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

    – Daniele Prada
    Aug 1 '17 at 14:54











  • If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

    – Daniele Prada
    Aug 1 '17 at 15:08
















  • 2





    IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

    – steeldriver
    Aug 1 '17 at 14:04











  • Thank you @steeldriver, but that did not work

    – Daniele Prada
    Aug 1 '17 at 14:28













  • Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

    – steeldriver
    Aug 1 '17 at 14:42











  • Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

    – Daniele Prada
    Aug 1 '17 at 14:54











  • If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

    – Daniele Prada
    Aug 1 '17 at 15:08










2




2





IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

– steeldriver
Aug 1 '17 at 14:04





IIRC the authorized_keys file should be -rw------- (octal mode 600) and the ~/.ssh directories themselves should be drwx------ (octal mode 700) on both client and server

– steeldriver
Aug 1 '17 at 14:04













Thank you @steeldriver, but that did not work

– Daniele Prada
Aug 1 '17 at 14:28







Thank you @steeldriver, but that did not work

– Daniele Prada
Aug 1 '17 at 14:28















Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

– steeldriver
Aug 1 '17 at 14:42





Just to be clear, are you entering your Unix password for the remote account, or the passphrase that you entered when generating the keypair? Is your home directory on the remote host encrypted?

– steeldriver
Aug 1 '17 at 14:42













Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

– Daniele Prada
Aug 1 '17 at 14:54





Good point. I am entering the passphrase entered when generating the keypair. Concerning my home directory on the remote host, I did: ls -a /home and found no .encryptfs folder, so I assume it is not encrypted. Am I correct? Sorry for the stupid question, but am I supposed to run some combination of adduser/passwd on the host?

– Daniele Prada
Aug 1 '17 at 14:54













If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

– Daniele Prada
Aug 1 '17 at 15:08







If that helps, entering any other random combination of characters, always returns Permission denied, please try again. I just tried

– Daniele Prada
Aug 1 '17 at 15:08












4 Answers
4






active

oldest

votes


















0














Instead of using the hostname of the server, try using the ip-adres.

I ran into the same problem when setting up my server and this seemed to resolve the problem.



ssh [username]@[host_ip-adres]



If you want to use the hostname you might need to set up a dns-server.

but you can do without.






share|improve this answer
























  • Thank you @Bjorn, but it did not work

    – Daniele Prada
    Aug 1 '17 at 14:57











  • the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

    – Bjorn
    Aug 1 '17 at 15:37



















0














When you define Host with Host [hostname] you have to use ssh [hostname]



Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]






share|improve this answer































    0














    You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue. I recommend using key/id since when managed correctly, it is the more secure method.



    SSH will always fall back to asking for a password even in cases where it will never work. To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection. Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt). SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted. It is best to try only one key per connection attempt if you are certain that it is the correct one. Then you can repeat the connection attempts while making changes at the server. It will help to have log file information from the server. Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.






    share|improve this answer
























    • set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

      – Skaperen
      Jul 11 '18 at 0:58





















    0














    If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.



    SSH -i ~/.ssh/id_rsa user@host


    It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2faskubuntu.com%2fquestions%2f941936%2fssh-permission-denied-using-right-password%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Instead of using the hostname of the server, try using the ip-adres.

      I ran into the same problem when setting up my server and this seemed to resolve the problem.



      ssh [username]@[host_ip-adres]



      If you want to use the hostname you might need to set up a dns-server.

      but you can do without.






      share|improve this answer
























      • Thank you @Bjorn, but it did not work

        – Daniele Prada
        Aug 1 '17 at 14:57











      • the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

        – Bjorn
        Aug 1 '17 at 15:37
















      0














      Instead of using the hostname of the server, try using the ip-adres.

      I ran into the same problem when setting up my server and this seemed to resolve the problem.



      ssh [username]@[host_ip-adres]



      If you want to use the hostname you might need to set up a dns-server.

      but you can do without.






      share|improve this answer
























      • Thank you @Bjorn, but it did not work

        – Daniele Prada
        Aug 1 '17 at 14:57











      • the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

        – Bjorn
        Aug 1 '17 at 15:37














      0












      0








      0







      Instead of using the hostname of the server, try using the ip-adres.

      I ran into the same problem when setting up my server and this seemed to resolve the problem.



      ssh [username]@[host_ip-adres]



      If you want to use the hostname you might need to set up a dns-server.

      but you can do without.






      share|improve this answer













      Instead of using the hostname of the server, try using the ip-adres.

      I ran into the same problem when setting up my server and this seemed to resolve the problem.



      ssh [username]@[host_ip-adres]



      If you want to use the hostname you might need to set up a dns-server.

      but you can do without.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 1 '17 at 14:53









      BjornBjorn

      31




      31













      • Thank you @Bjorn, but it did not work

        – Daniele Prada
        Aug 1 '17 at 14:57











      • the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

        – Bjorn
        Aug 1 '17 at 15:37



















      • Thank you @Bjorn, but it did not work

        – Daniele Prada
        Aug 1 '17 at 14:57











      • the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

        – Bjorn
        Aug 1 '17 at 15:37

















      Thank you @Bjorn, but it did not work

      – Daniele Prada
      Aug 1 '17 at 14:57





      Thank you @Bjorn, but it did not work

      – Daniele Prada
      Aug 1 '17 at 14:57













      the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

      – Bjorn
      Aug 1 '17 at 15:37





      the authorized keys are user specific, if you did not make the directory in the home folder of the user you want to remotely connect to the rsa key will not be found

      – Bjorn
      Aug 1 '17 at 15:37













      0














      When you define Host with Host [hostname] you have to use ssh [hostname]



      Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]






      share|improve this answer




























        0














        When you define Host with Host [hostname] you have to use ssh [hostname]



        Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]






        share|improve this answer


























          0












          0








          0







          When you define Host with Host [hostname] you have to use ssh [hostname]



          Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]






          share|improve this answer













          When you define Host with Host [hostname] you have to use ssh [hostname]



          Permission is denieed because you're not actually using the keyfile when ssh [user]@[hostname]







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 5 '18 at 1:45









          SensSens

          101




          101























              0














              You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue. I recommend using key/id since when managed correctly, it is the more secure method.



              SSH will always fall back to asking for a password even in cases where it will never work. To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection. Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt). SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted. It is best to try only one key per connection attempt if you are certain that it is the correct one. Then you can repeat the connection attempts while making changes at the server. It will help to have log file information from the server. Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.






              share|improve this answer
























              • set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

                – Skaperen
                Jul 11 '18 at 0:58


















              0














              You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue. I recommend using key/id since when managed correctly, it is the more secure method.



              SSH will always fall back to asking for a password even in cases where it will never work. To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection. Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt). SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted. It is best to try only one key per connection attempt if you are certain that it is the correct one. Then you can repeat the connection attempts while making changes at the server. It will help to have log file information from the server. Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.






              share|improve this answer
























              • set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

                – Skaperen
                Jul 11 '18 at 0:58
















              0












              0








              0







              You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue. I recommend using key/id since when managed correctly, it is the more secure method.



              SSH will always fall back to asking for a password even in cases where it will never work. To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection. Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt). SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted. It is best to try only one key per connection attempt if you are certain that it is the correct one. Then you can repeat the connection attempts while making changes at the server. It will help to have log file information from the server. Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.






              share|improve this answer













              You should decide whether you want connection authentication by key/id or by password then focus on that to find the issue. I recommend using key/id since when managed correctly, it is the more secure method.



              SSH will always fall back to asking for a password even in cases where it will never work. To avoid this use -o 'batchmode yes' (these quotes are needed) on the client ssh command making the connection. Then if the key cannot be accepted, it bypasses the password prompt (this is normally for use of ssh in a script that needs to avoid getting stuck at the password prompt). SSH will only try 3 keys at one time, so if the valid key is the 4th, it will not be tried and the connection will be aborted. It is best to try only one key per connection attempt if you are certain that it is the correct one. Then you can repeat the connection attempts while making changes at the server. It will help to have log file information from the server. Do grep sshd /var/log/auth.log to see what sshd is trying to tell you.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 11 '18 at 0:50









              SkaperenSkaperen

              1811117




              1811117













              • set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

                – Skaperen
                Jul 11 '18 at 0:58





















              • set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

                – Skaperen
                Jul 11 '18 at 0:58



















              set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

              – Skaperen
              Jul 11 '18 at 0:58







              set all file modes to the most secure, 0600 (-rw-------) for regular files, 0700 (drwx------) for directories. you have no reason to allow anyone else to read these.

              – Skaperen
              Jul 11 '18 at 0:58













              0














              If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.



              SSH -i ~/.ssh/id_rsa user@host


              It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing






              share|improve this answer




























                0














                If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.



                SSH -i ~/.ssh/id_rsa user@host


                It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing






                share|improve this answer


























                  0












                  0








                  0







                  If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.



                  SSH -i ~/.ssh/id_rsa user@host


                  It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing






                  share|improve this answer













                  If you didn't load your private key (the one without .pub) into the ssh-agent then you need to specify it in your ssh connection.



                  SSH -i ~/.ssh/id_rsa user@host


                  It looks like it isn't asking you for your ssh key pass, but your user pass which is why your password is failing







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 16 '18 at 17:07









                  SteamerJSteamerJ

                  2115




                  2115






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f941936%2fssh-permission-denied-using-right-password%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

                      Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                      Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                      Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...