Security

chmod

This program lets you adjusts the permissions on a file or directory. The first way you can use this program is to specify the entire mode of the file(s) you want to change. For example:

$ chmod 640 afile.txt bfile.txt cfile.txt

This changes the named files to rw-r------ permissions. The permissions they had are not important.

The second way you can use this program is to specify the changes you want to make. For example

$ chmod u+x afile.txt    # Give user (owner) (x) permission
$ chmod o+r afile.txt    # Give other (public) (r) permission
$ chmod ug+rw afile.txt  # Give user & group (r) and (w)

You can only change the permissions on files you own.

chown

This program lets you change the ownership of a file. You can only change the ownership of files you own. Once you've changed the ownership, you can't change the ownership back. In a system where disk quotas are enforced, chown will probably not be executable by normal users. The syntax of this program's command line is:

$ chown newowner afile.txt bfile.txt ...
chgrp

This program lets you change the group association of a file. You can only change the group association of files that have GID of a group for which you are currently a member. The syntax of this program's command line is similar to that of chown.

umask

This is actually a built-in shell command and not a utility program. (You will find information about it in the sh entry of the manual; not the umask entry) You use umask to define the permission bits that are OFF BY DEFAULT whenever a new file is created. For example

$ umask 022    # rwxr-xr-x will be the default permissions.
$ umask 027    # rwxr-x--- are the defaults.
$ umask 077    # rwx------ are the defaults.

Normally, you execute a umask command in your shell's login script ($HOME/.profile for the Bourne and Korn shells).