Ubuntu – Error creating folder: Permission denied

permissions

I am using VM Player for Ubuntu, then using WinSCP I need to copy the installer of a CMS to /var/www/html but it always says –

Error creating folder
Permission denied.
Error code: 3
Error message from server: Permission denied

Even when I try to create a folder it gives the same error. Thank you! I'm a student adnd this is for project purposes.

Best Answer

That's because /var is owned by root, so you have to be temporarily root to access it ..

That's exactly what's the sudo command for, for making you look like another user, which is root by default.

The root user happens to have access to everything on the system, whether it belonged to you, root, or whatever ..

So, to create a folder in a folder that isn't yours, you use sudo.
In other words, you have to do the following.

  1. Open a Terminal Window
  2. Copy the installer using the command:

    sudo cp <installer_path> <directory_to_copy_to>
    

    (directory would be /var/www/html in your case)

  3. You'll be prompted to enter your password, do it.

You're done!

Related Question