From:  http://www.robelle.com/smugbook


"Modes" are UNIX-Speak for File Security

A UNIX file has permissions or modes that define who can do what to it. There are three access types (read, write, execute) and three accessors: the user who owns it, the group that may have access to it, and all "other" users. Use the ls command with the -l option to see the permissions, the file owner and the file group. Use id command to see your logon user and group. Use chmod to change file permissions, chown to change file owner, and chgrp to change file group. Don't forget to give execute access to script files, this is not the default access for a new file (use keep filename,xeq in Qedit when saving a new script file). The umask command is used to set default permissions for new files.

Permissions are coded in triples of Read-Write-Execute for Owner-Group-Other. All access to everyone is rwxrwxrwx. Read access only to everyone is r--r--r--. Read/write/execute for the owner only is rwx------.

Text version.
% chmod +x jtest {give execute access to all}
% chmod u+x g-x o-x {add x for owner, remove from group/other}
% chmod g=rw,o= file {group=r/w only, other=no access,u=no change
% chmod 640 jfile {numeric mode 640 equals rw-r-----}

Permissions can also be coded as a 3-digit numeric value:

Text version.




owner group other
read = 4 rw- r-- ---
write = 2 4+2+0 4+0+0 0+0+0
execute = 1 6 4 0

Use ACLs (Access Control Lists) to specify more precise security. chmod deletes ACLs unless you do chmod -A.