Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 dont have the permission to rename (move) the directory.

What is happening ?

share|improve this question
    
Renaming file / directory D/A requires no permissions on A, only on D. –  jw013 Aug 22 '12 at 23:56

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
    
So simple, but I didnt thought of it, thanks! –  Johnny5 Aug 23 '12 at 1:08

Your Answer

 
discard

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.