Centos SSH keys

Shockey

2[H]4U
Joined
Nov 24, 2008
Messages
2,279
hello, I trying to setup a hadoop cluster here. I hit a bump in the road of trying to set it up it seems. when i try and copy the id_rsa.pub to authorized_keys says it doesn't exit. I go to the folder (.ssh) and it also doesn't show it.

i ran first.
Code:
ssh-keygen -t rsa

then

Code:
[hadoop@master .ssh]$ cat id_rsa.pub /home/hadoop/.ssh/authorized_keys
(key removed.)
cat: /home/hadoop/.ssh/authorized_keys: No such file or directory

Anyone shed some light on this and how to get this to work correctly.


Thanks in advance!
 
cat reads all files listed on its command line and dumps them to stdout. Your command is trying to read the authorized_keys file (which doesn't exist yet), not write to it. You probably meant to do:
Code:
cat id_rsa.pub > /home/hadoop/.ssh/authorized_keys

Which takes the stdout from cat and redirects it into the file.
 
cat reads all files listed on its command line and dumps them to stdout. Your command is trying to read the authorized_keys file (which doesn't exist yet), not write to it. You probably meant to do:
Code:
cat id_rsa.pub > /home/hadoop/.ssh/authorized_keys

Which takes the stdout from cat and redirects it into the file.

I guess my copy and paste to putty didn't work correctly.

this is the original command from the tutorial

Code:
cat /home/hadoop/.ssh/id_rsa.pub >>  /home/hadoop/.ssh/authorized_keys

My laziness i guess got the better of me. Your code work out for me. Thank you for the quick reply and explaining it!
 
For future reference, >> is append, > will overwrite the existing file.
 
For future reference, >> is append, > will overwrite the existing file.

Alright thank you.

Do you happen to know how to find where java is installed on centos system?

it came installed i beleive cause i ran yum update and seen it was being updated.
 
Alright thank you.

Do you happen to know how to find where java is installed on centos system?

it came installed i beleive cause i ran yum update and seen it was being updated.

Generally Linux is not like Windows, where programs are installed to a single directory. Java will likely have files all over the filesystem, though RedHat distros sometimes use /opt for things like Java, I'm not sure, I don't use them.

If you just want to know the path to the java binary, you can use 'which java'.
 
Generally Linux is not like Windows, where programs are installed to a single directory. Java will likely have files all over the filesystem, though RedHat distros sometimes use /opt for things like Java, I'm not sure, I don't use them.

If you just want to know the path to the java binary, you can use 'which java'.


which java did the trick. I need it to run hadoop which is written in java. :)

Thanks for the help.
 
Back
Top