0

I am trying to enable passwordless ssh for Hadoop 2.6.0. The method I tried is as follows:

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

I also tried adding the following things to ssh_config file as mentioned in some questions on here

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PermitRootLogin yes

Still, I am not able to ssh into the localhost. The output of ssh -v localhost is as follows:

OpenSSH_6.8p1, OpenSSL 1.0.2a 19 Mar 2015
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/MP30589/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_rsa-cert type -1
debug1: identity file /home/MP30589/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MP30589/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.8
debug1: match: OpenSSH_6.8 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:l/78VMLSVdtD9SMx46+m4NZt4Kmd1x8I038v9ozQYbM
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/MP30589/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/MP30589/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering DSA public key: /home/MP30589/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/MP30589/.ssh/id_ecdsa
debug1: Trying private key: /home/MP30589/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
MP30589@localhost's password:

Can anyone please help me out here? Thanks in advance!

Edit:

I have also tried changing the file permissions as follows, but the error still shows up

chmod 700 ~/.ssh 
chmod 600 ~/.ssh/authorized_keys
5
  • Same as (askubuntu.com/questions/627419/…). I am still looking for answer
    – Incredible
    May 25, 2015 at 11:11
  • The lines you added to ssh_config are actually meant for sshd_config, but in any case I doubt they'd make a difference.
    – muru
    May 25, 2015 at 11:36
  • Eeeek! Don't change the permissions! Ever! Nothing will work if you change the permissions on those files. You need id_dsa and authorized_keys to be 600 but id_dsa.pub and config etc. to be 644.
    – terdon
    May 25, 2015 at 13:20
  • I tried keeping the permissions the same as well. Not helping.
    – sgp
    May 25, 2015 at 13:23
  • // , Keep in mind that the target user usually must have a password set before you can SSH to it with a keypair. Also, reformat this as a question, not a tech. support ticket. Jan 21, 2017 at 1:58

1 Answer 1

1

That's not the way to do it. First of all, to set up passwordless access, you need a target machine. It is not something you set up locally, you must set up passwordless access to somewhere. Anyway, the way to do it is:

ssh-keygen -t rsa -P ''

That will generate your key. Now, you need to copy it to the target machine:

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

Once you've done that, you'll be able to log into remote.com with no password.

10
  • I tried that initially but it keeps on asking for a password (which I don't have)
    – sgp
    May 25, 2015 at 13:00
  • @sgp sure you do. It's your password for the machine you're trying to connect to. If you don't have one, then you don't have access to the target machine and, obviously, you can't set up passwordless access.
    – terdon
    May 25, 2015 at 13:04
  • But the method I'm trying is basically adding the public keys to the authorized ones. Don't you think this should work too? For some weird reason, the service doesn't check the keys, I guess
    – sgp
    May 25, 2015 at 13:07
  • @sgp what are you trying to connect to? Your approach might, though I doubt it since the format of the files is wrong, work for localhost but not for any other.
    – terdon
    May 25, 2015 at 13:10
  • Yes, I am trying to just connect to localhost. I agree it won't work for any other hosts but the thing which is bothering me is that it is not working for localhost as well :/
    – sgp
    May 25, 2015 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .