Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get a Permission denied message when trying to rename files and folders in places like /, /usr, and other people's home directories. I'm an administrator. How can I do this?

Also, I've heard that renaming files and folders like this could be dangerous. Is that true? Should I not be doing this?

share|improve this question
+1 Excellent Question :) – atenz Jul 20 '12 at 16:39
up vote 14 down vote accepted

It is usually bad to rename items that reside directly in / or directly in any of its subfolders (like /usr). In fact, you should avoid renaming anything outside your home directory unless you are sure you need to do so and that you're doing it correctly. Otherwise, you might rename something critical to the functioning of your Ubuntu system, causing it to stop working (or stop working properly).

If you find yourself asking something like the question above, you should consider posting a new question, where you provide more information about what you want to accomplish, or add details if you've already asked your question.

In the Terminal

To rename a file or folder in the Terminal, use the mv command (the same command used to move a file or folder from one place to another on the same partition):

mv old-name new-name

If the file or folder resides in a folder where you do not have write permissions (which is often the case when you are not its owner), then you must run run this command as root with sudo:

sudo mv old-name new-name

(Or you could use sudo -u username mv old-name new-name to perform the renaming operation as another non-root user, if you prefer. Also, please note that if you have write permissions on a directory you don't own, but its sticky bit is set, you won't be able to rename files inside it that are not owned by you, without using sudo.)

In Nautilus

You can run the file manager, Nautilus, as root by pressing Alt+F2 and running the command gksu nautilus. This will let you rename files and folders anywhere and do all sorts of other powerful and dangerous things.

Be careful, and remember that any programs you launch (like by opening documents) from a root Nautilus window will also run as root, and make sure to close the window when you're done so you don't later confuse it with a regular, safer Nautilus window.

But please do not rename stuff outside your home directory, unless you really, really know what you are doing. It will probably break your Ubuntu system badly. And it will probably not accomplish whatever you are trying to achieve.

Thanks to richard for helping to clarify the conditions under which a user can rename an item without a Permission denied error.

share|improve this answer

Even if you are an administrator, when normally using your desktop, you have typical user privileges. This way, anyone who gains access to your account (e.g. a virus) would not have complete control of the system.

To run a program with administrative privileges, you need to use gksu form the Alt-F2 prompt, or sudo in the terminal. For example, pressing Alt+F2 and typing gksu nautilus, will prompt you for a password (to prove that it's really you) and launch a file browser with administrative privileges. With this window, you will be able to modify anything on the system, BUT BE CAREFUL

In particular, you shouldn't mess with anything outside of /home unless you know what you're doing. The other folders contain system files. Modifying those files could cause your computer to break. If you're trying to accomplish a specific task, and aren't sure how to fix it, you should open a new question to get instructions on how to fix it. Often times, there are easy fixes that won't break your system.

For example, renaming the /usr folder will break nearly every program on your computer, including the programs required to use your graphical interface...

In other words, you need to be fairly experienced with Linux in order to fix that kind of problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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