Search code examples
puttylinode

mkdir -p ~ /.ssh returning Permission Denied


This is the very first time for me to start deploying website using Linode. So now I am following a tutorial and after creating a user in server I am trying to create a folder using mkdir -p ~ /.ssh but I keep receiving mkdir: cannot create directory ‘/.ssh’: Permission denied

I am using Linode Ubintu and using Putty. So my question is why am I receiving this error and how do I fix it?


Solution

  • You have an extra space in your command:

    mkdir -p ~ /.ssh
              ^ here
    

    That space splits the path you wanted (~/.ssh) to the new 2 paths: ~ and /.ssh. Note that the second one is in the root (/) directory, which requires additional access rights to write in. But you most probably wanted to create .ssh in your home directory (to which the ~ leads), so proper command would be:

    mkdir -p ~/.ssh