Can't create new SSH key


Hi everyone!

I got stuck at “Project: Your First Rails Application” section. I run the command ssh-keygen -C, and everything seems to be fine, console informs that my identification has been saved in /root/.ssh/id_rsa, as well as my key which is at /root/.ssh/ After that it gives me a “randomart image”.

After that, when I runcat ~/.ssh/ for the console to show me my SSH key, it returns me the message cat: /home/matias/.ssh/ No such file or directory.

I cd into /, run ls there and there’s no .ssh folder. If I try to cd into /.ssh, console returns “No such file or directory” again.

Apparently the command ssh-keygen -C is not creating the folder, although it says the operation was succesful after running it.

I’m doing all of that logged in as root user, so that shouldn’t be the problem. How can I proceed from, here?

Thanks in advance.


It sounds like an issue with partitioning. /root and /home are two different things, although I’m not sure how to help.

Is this a dual-boot system?


No, it’s Ubuntu running inside VirtualBox. A few minutes ago I tried saving to an .ssh folder, first at /home/myuser, and then at /, but didn’t work.

I then tried manually creating the .ssh/id_rsa directory through GUI and then saving the key, but the ssh-keygen -C command still returned No such file or directory


I think the problem is that your key was saved to your root directory, but you used cat to find it in your home directory.

Instead of:
cat ~/.ssh/

cat /.ssh/

Did you run ls -a in your root folder? without the -a tag, ls won’t show you hidden files and folders, and thus wouldn’t show you .ssh, because it has a . in front of it.


Thanks for your answer!

The problem is I was running everything as root, so as you said, the directory was being created at /.

Tried again without root permission and everything worked fine. About the directory supposedly created at /, it was never there. Couldn’t see it with ls -a nor with a GUI file manager with Ctrl + H.

But hey, it worked! Thanks for your time