I am new to Ubuntu so please forgive my inexperience.

I am running Ubuntu Desktop 16.04.1 and I am set up as an administrator, I am the only user so I believe therefore I should be a root user.

However, when I try to copy a file from the root /var/www/html and paste it in /var/www/ directory, using any file management software (i.e. File manager, Files, Dolphin, etc.), I get the error message: Access denied. Could not write to.

Why can I not write to these directories?

Could this be because I have the automatic login option turned on?


You're not the root user. In some Linux distros, you are root by default and have to set up other users (because being root is bad practice for security reasons) yourself. In Ubuntu, the user you create during installation is a user with rights to run all commands using the sudo program.

This means you can do pretty much anything you want, but you need to use sudo to elevate permissions temporarily when you want to do something that requires root permission, such as writing to system directories of which your user is not the owner. The sudo program allows you to run commands as root

Therefore, to copy a file to a directory you don't own and that does not have permission for you to write to, you could run (in a terminal, open one with Ctrl+Alt+T)

sudo cp /path/to/file /path/to/destination

Or to use a graphical browser:

sudo -i      # to open a root shell
nautilus     # or caja or dolphin or whatever program you use

do your thing, and when done, enter


in the terminal, to drop privileges.


Using sudo can solve your problem.

 sudo allows user to run commands as root.


1) sudo cp path for source file
path for destination folder

2) sudo rm -rf path of file or folder

  • How exactly is this is different than the answer given yesterday? What does it add? – user589808 Feb 17 '17 at 5:57
  • Yup! Seems no change. Haven't read the first answer. – Deva Feb 17 '17 at 6:15
  • It's just I saw question and answered. :) – Deva Feb 17 '17 at 6:18
  • Sudo doesn’t help when using desktop file editor or the file manager to move file and folders. Changing ownership is not a valid solution either but so far I’ve not found the combination of ownership, group membership and permissions that does work! – DonP Jan 11 '20 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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