I am running Ubuntu 12.04 x64 server on ext4 partition.

I set a directory's permission to '766' as below.

sudo chmod 766 /archive

drwxrw-rw- 3 root root 4096 Sep 27 10:50 archive/

But, when I tried to create new file through vi editor, permission error has occured.

vi /archive/test.txt
-------- > "/archive/test.txt" [Permission Denied]

I thought I had "write" permission.

Could anyone help me what is the problem?

  • the vi command is running with root user too ? – white-shy-guy Sep 27 '12 at 3:39

I guess that the directory /archive already contains a file called test.txt, maybe created previously by the root. If so, then you have to either remove it, or change the permissions accordingly. Try

chmod -R 766 /archive

This will change the permissions recursively for all files and directories in the archive.

However, what are you trying to accomplish? In most cases it is not necessary to set such permissive permissions.

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.