In Unix-based systems, files and directories have access permissions.
If you open a terminal and run:
You will get something like:
drwx------: file type and permissions.
dindicates that it is a directory. The following nine characters represent the permissions for the file or directory. In this example,
rwx------indicates that the owner of the directory (
aristot) has read, write, and execute permissions, while others have no permissions.
3: number of links to the file or directory. In this case, the directory
Applicationshas three links associated with it.
aristot: owner of the file or directory.
staff: group associated with the file or directory.
96: file size in bytes. For directories, the size generally represents the amount of disk space used by the directory’s metadata.
Feb 15 10:20: date and time of the last modification to the file or directory.
Applications: name of the file or directory.
More about file permissions permissions:
d: directory. Files don’t have this.
The reason there are 9 characters apart from
d, is that each file/directory has permissions on three levels:
user: file owner
group: members of file’s group
others: everyone else
rwx------: file owner can read, write and execute the file, and everyone else can do nothing.
r-xr-x--x: file owner and group can read and execute. Everyone else can only execute.
Each permission is associated with a number:
x: 1. This results in a unique sum for each permission set:
rwx: 4+2+1 = 7
rw-: 4+2 = 6
r-x: 4+1 = 5
-wx: 2+1 = 3
chmod is just a command-line tool that allows you to change permissions:
chmod 755 /some/filesets the permissions to
rwxfor owner and
r-xfor group and others.
chmod +x /some/fileadds execute permission to all.
chmod -w /some/fileremoves write permission from all.