Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share
    
You have created the directory using sudo. That means it belongs to root. If you run "ls -ld archive" you will see the owner as root. I guess you know that. Permission 4 is for read, 2 for write and 1 for execute. To browse (ls) a directory you must have read and execute permission. If you chmod 755 instead of 766 you can browse the dir, because others (you) can read and execute. But again to create a file you need write permission too. I.e if you are not root you need 777 (user=root, group=root, others=you) to write a file. You can make yourself a user of file using chown <yourname> archive –  razorxpress Sep 27 '12 at 2:28
comments disabled on deleted / locked posts

migration rejected from stackoverflow.com Aug 7 '13 at 19:44

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by fossfreedom Aug 7 '13 at 19:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – fossfreedom
If this question can be reworded to fit the rules in the help center, please edit the question.