Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Configuring passphraseless problem

avatar
Explorer

I tried to create passphraseless SSH as mention in below link.

https://learninghadoopblog.wordpress.com/2013/08/03/hadoop-0-23-9-single-node-setup-on-ubuntu-13-04/

hadoop@aruna:~$ pwd
/home/hadoop
hadoop@aruna:~$ ls -al
total 40
drwxr-xr-x 2 hadoop hadoopgroup 4096 Feb 17 17:56 .
drwxr-xr-x 5 root  root  4096 Feb 17 17:53 ..
-rw-r--r-- 1 hadoop hadoopgroup  220 Feb 17 17:53 .bash_logout
-rw-r--r-- 1 hadoop hadoopgroup 3771 Feb 17 17:53 .bashrc
-rw-r--r-- 1 hadoop hadoopgroup 8980 Feb 17 17:53 examples.desktop
-rw------- 1 hadoop hadoopgroup 1679 Feb 17 17:56 Hadoop_RSA_KeyPair
-rw-r--r-- 1 hadoop hadoopgroup  394 Feb 17 17:56 Hadoop_RSA_KeyPair.pub
-rw-r--r-- 1 hadoop hadoopgroup  655 Feb 17 17:53 .profile
hadoop@aruna:~$ 

I followed two steps as mention above link.

But when i try to Write the public key file for the generated RSA key into the authorized_key fil it gives me issue.

# Write the public key file for the generated RSA key into the authorized_key file
$ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

This is the issue.It says there is no such file or directory.

hadoop@aruna:~$ cat Hadoop_RSA_KeyPair.pub >> $HOME/aruna/.ssh/authorized_keys -su: /home/hadoop/aruna/.ssh/authorized_keys: No such file or directory

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Aruna Sameera

First you will have to generate the "ssh-keys"

Example: (Use all default values ... keep pressing enter with the "ssh-key" command.) I mean empty passphrase.

$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jay/.ssh/id_rsa): 
Created directory '/home/jay/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/jay/.ssh/id_rsa.
Your public key has been saved in /home/jay/.ssh/id_rsa.pub.
The key fingerprint is:
a1:70:20:75:52:aa:c6:0c:66:1e:c5:e6:61:11:91:43 jay@erie1.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|  ..o ...+E+     |
|   . o=.o =      |
|    .+.A.o o     |
|     o..*.o      |
|      . Ao       |
|                 |
|                 |
|                 |
|                 |
+-----------------+

The easiest approach will be to use the "ssh-copy-id" command:

Example:

ssh-copy-id -i ~/.ssh/id_rsa.pub localhost
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari1.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari2.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari3.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari4.example.com

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Aruna Sameera

First you will have to generate the "ssh-keys"

Example: (Use all default values ... keep pressing enter with the "ssh-key" command.) I mean empty passphrase.

$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jay/.ssh/id_rsa): 
Created directory '/home/jay/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/jay/.ssh/id_rsa.
Your public key has been saved in /home/jay/.ssh/id_rsa.pub.
The key fingerprint is:
a1:70:20:75:52:aa:c6:0c:66:1e:c5:e6:61:11:91:43 jay@erie1.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|  ..o ...+E+     |
|   . o=.o =      |
|    .+.A.o o     |
|     o..*.o      |
|      . Ao       |
|                 |
|                 |
|                 |
|                 |
+-----------------+

The easiest approach will be to use the "ssh-copy-id" command:

Example:

ssh-copy-id -i ~/.ssh/id_rsa.pub localhost
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari1.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari2.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari3.example.com
ssh-copy-id -i ~/.ssh/id_rsa.pub kerbambari4.example.com

.

avatar
Explorer

my .ssh folder is located in /home/aruna$ folder.

My Hadoop_RSA_KeyPair.pub file is located in /home/hadoop folder.

So i try to copy key file from /home/hadoop to /home/aruna/.ssh folder as shown below.

hadoop@aruna:~$ ssh-copy-id -i  Hadoop_RSA_KeyPair.pub $HOME/aruna/.ssh/authorized_keys
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "Hadoop_RSA_KeyPair.pub"
mktemp: failed to create file via template ‘/home/hadoop/.ssh/ssh-copy-id_id.XXXXXXXXXX’: No such file or directory
/usr/bin/ssh-copy-id: ERROR: mktemp failed

But it gives me error?

avatar
Master Mentor

@Aruna Sameera

You do not need to copy ssh keys from "hadoop" user to "aruna".

Which user you want to use in order to start Hadoop? "aruna" or "hadoop"

When you run the "ssh-keyhen" command then by default it send the keys to the "/home/<username>/.ssh" directory.

Also "

$HOME/aruna/.ssh/authorized_keys   <== means ==>  /user/aruna/aruna/.ssh/authorized_keys

.

Because $HOME itself is "/user/<username>" , Here username will be replaced by the name of the logged in user who is running the command.

.

avatar
Explorer

@jen SenSharma

1) Since i am currently using "aruna" username its better if i can use same for all the things in hadoop also.

actually this all starts when i try to start DFS demon. The it keep asking below thin.

The authenticity of host 'localhost (127.0.0.1)' can't be 
established. ECDSA key fingerprint is 
SHA256:AlJLUiaOyWSm5W3+VAi1hDfgpFvZeLOMU6a4lviRojE. Are you sure you 
want to continue connecting (yes/no)?

Then I followed steps in below link to Configuring passphraseless SSH

https://learninghadoopblog.wordpress.com/2013/08/03/hadoop-0-23-9-single-node-setup-on-ubuntu-13-04/.

I completed first 2 steps. Third step is as below

# Write the public key file for the generated RSA key into the authorized_key file
$ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

2) So when i try to complete it gives me error . Still i am unable to complete the above step.

avatar
Expert Contributor

@Aruna Sameera,

What is the error you get? Can you ls -l $HOME/.ssh/id-rsa.pub ?