".ssh/config" E212: Can not open file for writing

20,898

If the .ssh folder didn't exist you could get this.

In which case you could create it first with:

mkdir ~/.ssh
chmod 700 ~/.ssh
Share:
20,898

Related videos on Youtube

Lorraine
Author by

Lorraine

Updated on September 18, 2022

Comments

  • Lorraine
    Lorraine over 1 year

    I'm new to linux. I downloaded an image of ubuntu 12 for VirtualBox and I want to configure the .ssh/config file to access via ssh to an application in development.

    I access /home/ubuntu folder and I login as root, I type vim .ssh/config and when I save I get the error: .ssh/config E212: Can not open file for writing. Y saved it with :w, :w!, :wq! and I can´t.

    I tried with sudo .ssh/config and sudo ~/.ssh/config.

    I've tried different virtual machines so i don't know can be causing this error. I hope you can help me.

    • Admin
      Admin over 10 years
      Open your editor as root user.
    • Admin
      Admin over 10 years
      Are you trying to configure the ~/.ssh/config? If so, you should't need to be root.
  • An Amateur
    An Amateur over 10 years
    Yes, I tried it too... but I have the same problem.
  • Lorraine
    Lorraine over 10 years
    Thanks for your response, but I still have problem to save it. I typed that and this is the output: :w !sudo tee % > /dev/null tee: .ssh/config: No such file or directory shell returned 1 How can I know if the image is for readonly ? ¿Can someone link a image without this problem?