A directory called "test_dir" with the owner having full persmissions to create, rename or delete files in the directory, list files and enter the directory. Group and other having permissions to only list files and enter the directory and access files within it.
-
and your problem is..? – Ron Sep 06 '15 at 08:57
-
2possible duplicate of How do file permissions work? – karel Sep 06 '15 at 09:24
2 Answers
If I understood you correctly, you need the following:
#create a directory
mkdir test_dir
#change the permissions
chmod 755 test_dir/
Now, test it:
ls -l | grep test_dir
drwxr-xr-x 2 ron ron 4096 Sep 6 14:30 test_dir
Here, ron has all the access to test_dir
whereas the group and others can read test_dir
but has not write access to it.

- 20,638
For directories:
the x bit (executable) means you can change into the directory the w bit (writable) means you can create files and directories the r bit (readable) means you can read the directory which files and directory it contains.
Now the permissions:
r-bit = 4 = 2^2
w-bit = 2 = 2^1
x-bit = 1 = 2^0
the first digit stands for the owner, the second for the group and the third for the rest
That means if you want that the owner has the full access you need to calculate the bits: 4+2+1 = 7 = the owner can read, write and execute the directory. E.g.
$ chmod 777
means the owner, the group and all other can read, write and execute
$ chmod 755
means the owner can read, write and execute, the group and the rest can only read and execute the directory (because 5 = 4+1).
$ chmod 750
means the owner can read, write and access the directory, the group can read and access the directory and the rest has no right to the directory.

- 69
- 1
- 4