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 spark then I su - spark and cdand then make the .ssh directory with: mkdir ~/.ssh chmod 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.


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
| improve this answer | |
  • 1
    Wow...Orz, that's the problem!! I thought the y option is for automatically confirmation. Thank you!! you save my day, I was about to compile newest openssh from scratch.. – Allan Ruin Aug 11 '16 at 3:31
  • @AllanRuin yes it's an odd choice of letter since -y means exactly that for several other commands – steeldriver Aug 11 '16 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.