I tried to setup a spark cluster environment and when I trying to setup password-free ssh login for user spark, I came across this problem.
I create the user spark by
groupadd spark useradd -g spark spark passwd spark mkhomedir_helper sparkthen I su - spark and cdand then make the .ssh directory with:mkdir ~/.sshchmod 700 ~/.ssh
Finally, I use ssh-keygen -t rsa -y to generate the key pairs, then it show /home/spark/.ssh/id_rsa: No such file or directory.
Yes, you see the problem correct, I'm not asking about .ssh/authorized_keys: No such file or directory. I knew that there are tons of posts concerning the famous authorized_keys priviledge setting. But this ~/.ssh/id_rsa: no such file error have almost no information on the web.
Do you have any suggestions? Thank you.
In case it's a version specified bug, I am using OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014. I tried stop apparmor with /etc/init.d/apparmor stop and it's still the same error.
1 Answer
From man ssh-keygen:
-y This option will read a private OpenSSH format file and print an OpenSSH public key to stdout.so it fails because there is no existing id_rsa file.
If you want to create a new RSA key pair, run the command without the -y option, i.e.
ssh-keygen -t rsa 2