localhost: Permission denied (publickey,password,keyboard-interactive)

9,978

The private key should not be protected by a password. Check this post for checking that

Are the permissions on your private key properly set? It should be set as:

  chmod 600  ~/.ssh/id_rsa
Share:
9,978

Related videos on Youtube

Arefe
Author by

Arefe

Updated on September 18, 2022

Comments

  • Arefe
    Arefe almost 2 years

    I was trying to run Hadoop in Mac OS and I get the following errors,

    $ hstart
    
    
    WARNING: Attempting to start all Apache Hadoop daemons as chaklader in 10 seconds.
    WARNING: This is not a recommended production deployment configuration.
    WARNING: Use CTRL-C to abort.
    Starting namenodes on [localhost]
    localhost: Permission denied (publickey,password,keyboard-interactive).
    Starting datanodes
    localhost: Permission denied (publickey,password,keyboard-interactive).
    Starting secondary namenodes [macs-MacBook-Pro.local]
    macs-MacBook-Pro.local: Permission denied (publickey,password,keyboard-interactive).
    2018-08-14 13:59:34,949 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    Starting resourcemanager
    Starting nodemanagers
    localhost: Permission denied (publickey,password,keyboard-interactive).
    

    I looked into the Google and find a similar post. I mentioned that Permission denied is the error, and I didn't set up passwordless ssh correctly. For example, ssh localhost should not ask for a password.

    I run the ssh localhost and it did ask for the password. As a solution to the problem, it was mentioned to execute the command,

    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    

    I did that and afterward when I run the ssh localhost, I was asked for the passphrase (than the password).

    $ ssh localhost
    
    Enter passphrase for key '/Users/chaklader/.ssh/id_rsa': 
    Last login: Tue Aug 14 14:03:30 2018 from ::1
    

    The original problem was not solved. There was another post mentioned to execute the command chmod og-wx ~/.ssh/authorized_keys and after I did that, it still keeps that same.

    I tried to check what is inside the id_rsa and find the info,

    $ cat ~/.ssh/id_rsa.pub
    ssh-rsa 
    
    AAAAB3NzaC1yc2EAAAADAQABAAABAQDB/1Ryk4mB2/9rxpvF21JWKBOyx+hgo572zp9ZNcLmj1FcNN9saJ0AfYcmkILowEoCKgzOCbAvapd+JsPomPMsuKD37AGvfF88YWAjKPYOg3wo5JMwIp/CEyk349satGWUy+Q99288iJcS5NKkhLEN1bMOyIpgbFFxmpCdFXNSl9UfeCN4oyndWJzmnHkI6C9mu4BWibcW3PkKkwI2HVPop14m3jRjHJvmwGzRQxp/bjUVRqSZ52KTuVMYRrCsKdd048tBHOK0ujjshpBCoedtFoXt3xP0B78WZyvgFr2Pj9DrgdFI+T7gkJUv4xbmtKfCOZR7yFVwoUtgAF5k/FC1 [email protected]
    
    
    $ cat ~/.ssh/authorized_keys 
    ssh-rsa 
    
    AAAAB3NzaC1yc2EAAAADAQABAAABAQDB/1Ryk4mB2/9rxpvF21JWKBOyx+hgo572zp9ZNcLmj1FcNN9saJ0AfYcmkILowEoCKgzOCbAvapd+JsPomPMsuKD37AGvfF88YWAjKPYOg3wo5JMwIp/CEyk349satGWUy+Q99288iJcS5NKkhLEN1bMOyIpgbFFxmpCdFXNSl9UfeCN4oyndWJzmnHkI6C9mu4BWibcW3PkKkwI2HVPop14m3jRjHJvmwGzRQxp/bjUVRqSZ52KTuVMYRrCsKdd048tBHOK0ujjshpBCoedtFoXt3xP0B78WZyvgFr2Pj9DrgdFI+T7gkJUv4xbmtKfCOZR7yFVwoUtgAF5k/FC1 [email protected]
    

    This looks like the same info to me. What is here missed?

    • alpha
      alpha almost 6 years
      The two files will have exactly the same contents,cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys this is what that command achieves. It looks like you have a passphrase set, i would generate a new ssh-key with no passphrase, and add that key to authorized keys.
    • Arefe
      Arefe almost 6 years
      Why would that be helped?
    • alpha
      alpha almost 6 years
      because you have to enter a passphrase to log in? so you haven't set up passwordless ssh....
    • dr_
      dr_ almost 6 years
      @alpha That's incorrect. The command appends the pubkey to the authorized keys file. It's just that the authorized keys file was empty, so after running the command the OP ended up with two identical files.
    • Arefe
      Arefe almost 6 years
      Later I kept blank for the pass phrase and it worked
    • David Douglas
      David Douglas over 5 years
      In my case on Mac I had already created a key using a password. So to fix this I deleted the 'authorized_keys' file and regenerated new private key with blank password. Then the ssh localhost command worked without password prompt
  • Arefe
    Arefe almost 6 years
    The issue was the key was required a pass phrase