Ubuntu – Permission denied to create files in particular directory under home directory

13.10permissions

I copied a folder recursively from the /www/ directory to one of my directories under my home directory. Now, every time I want to create a file or a folder in this copied directory, it says permission denied. So, I have to use sudo every time.

The problem is that I can create files/folders in other directories under the home directory, except this one. I tried changing the permission of this directory recursively to 755 but still the same problem.

Can anyone point out what the exact problem I am facing is? And how do I get around this?

Best Answer

The folder, quite obviously, is property of the root user, which is why you have to use sudo in order to interact with the folder. I don't think chown is able to apply permission changes to a folder, so you would have to go for the graphical route, as explained below.

[EDIT] A folders location typically doesn't affect it's permissions level or owner. For example, I could be the owner of a folder sitting in /usr/share/, but root could be the owner of a folder on my desktop. If you're wondering why it is this way, I'd say ask Bell Labs. They started it. :)

(I used Nemo, but the steps are the same for Nautilus)

First, open a terminal and type sudo nautilus (again, I used Nemo, but it's the same procedure), and enter your sudoer's password.

sudo nautilus (in this case, nemo)

When Nautilus opens, navigate to the folder you wish to change permissions on. Depending on what program you use, you may see and "Elevated Privileges" notice. This is to remind the user to be careful with what they do, as root permissions could damage the computer if used the wrong way.

Navigate to the folder desired

Now right click the folder you want to change and choose "Properties" go to the "Permissions" tab, and it should look something like this:

Root permissions on folder

Select the dropdown menu for Owner and Group, and change them from "root" to your username (in my case, ben). It should look like this now:

How it should look

If desired, click "Apply Permissions to Enclosed Files". Then close Nautilus and exit the terminal.

Related Question