I am very new to Ubuntu I installed apache and I got the directory /var/www but I cant delete anyhting in that directory. It says: You are not the owner Now I assume I have to log in as root? but how do I log in as root and what is the standard password for root? Also how can I just give my own user the same permissions? Again I have little knowledge about linux and ubuntu etc.

  • I managed to fix it but is there a way to just give my own account the same permissions? – Loko Oct 22 '13 at 14:42
  • If this is your own installation on your computer, you should already have permissions. See the answer. :) – chaskes Oct 22 '13 at 14:48
  • possible duplicate of: How to avoid using sudo when working in /var/www? – Radu Rădeanu Oct 22 '13 at 14:52
  • 1
    There's a lot of good info at that link, but it's all very advanced and this user has little linux experience; so I don't think it's a duplicate. – chaskes Oct 22 '13 at 14:57

Ubuntu by default does not allow login as root. This is for security reasons. Ubuntu uses sudo, which allows users to issue commands with administrative privleges.

The user created during installation is automatically made an administrative user, meaning is already set up to use sudo.

Don't use the graphical file manager. Instead use the terminal.

ctrl+alt+t will open the terminal.

cd /var/www will get you to the directory.

You can delete files with sudo rm [files to delete].

You will be prompted for your sudo password, which is the same as your regular password. Nothing will show on the screen as you type your password.

Be very careful. rm removes files immediately and is generally not able to be undone. Check and double-check for typos.

You can use rm -i [filename] to get an Are you sure? prompt.


There are 2 ways to solve this problem.

1) add yourself to the owner group and set the premission using chmod to 775(see below) This can be done by the following commands:

sudo adduser yourusername www-data

That is assuming the owner group is www-data. It could also be "apache", just check what works.

Next you'll have to change the permissions for the files for yourself using chmod.

When using chmod, you need to be aware that there are three types of Linux users that you are setting permissions for. Therefore, when setting permissions, you are assigning them for "yourself", "your group" and "everyone else" in the world.

Therefore, when setting permissions on a file, you will want to assign all three levels of permissions, and not just one user.

So, in laymen terms, if you wanted a file to be readable and executable by everyone, and writable and executable by only you, you would write the chmod command with the following structure.


so in your case it would have to be like this:

chmod -R 775 /var/www

(The -R is to make it recursive, meaning all subfolders get the same permissions) The numbers reprisent this table

7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)

The other solution is to change the permissions to 745 without adding yourself to the www-group.

Please DO NOT use 777 for your webserver file permissions!!!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.