I have a directory with a big load of sub directories. I own all of them, and the permissions are all 777.

pascal@azazel /box $ ls -al
total 147872
drwxr-xr-x 293 root   root      12288 aoû 22 19:44 .
drwxr-xr-x  25 root   root       4096 jun 28 18:49 ..
drwxrwxrwx   7 pascal pascal     4096 aoû  4  2010 131082

I want to rename the directories:

pascal@azazel /box $ mv 131073 NewName
mv: impossible de déplacer « 131073 » vers « NewName »: Permission non accordée

The message is in French, basically it said that I don't have the permission to rename (move) the directory.

What is happening?

  • Renaming file / directory D/A requires no permissions on A, only on D. – jw013 Aug 22 '12 at 23:56

Renaming a file (whatever its type, including directories) means changing its name in the directory where it is located. In fact, renaming and moving inside the filesystem are the same operation; the file is detached from its old name and attached to its new name, which requires modifying both the source and the destination directory (for renaming inside one directory, the source and target directories are the same). The upshot is that you need write permission on the containing directory, /box in your example.

These are exactly the same permissions you'd need to copy the file then remove the original, by the way.

  • So simple, but I didnt thought of it, thanks! – Johnny5 Aug 23 '12 at 1:08

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.