CHMOD Command

HSI Version: 

All

Purpose: 

Changes permissions associated with HPSS nodes 

Aliases: 

 

Command Format: 

chm[od] [-d] [-f] -h] [-H] [-R] mode path ...

Options: 

-d : operate only on directory objects

-f : operate only on file objects

-h : suppress mode change for a file or directory pointed to by a symbolic link

-H : If the -R option is specified, symbolic links on the command line are followed. Default is not to follow symlinks for any path specified on the command line. Symbolic links encountered during recursion are never followed.

-R : [standard option]recursively traverse directories in the specified path(s)

mode : octal value or symbolic mode string. Run "!man chmod" for more details

path : files and/or directories whose permissions are to be changed

Keywords: 

DIRn 

Usage Notes: 

The mode of each named file is changed according to mode, which may be absolute or symbolic. An absolute mode is an octal number constructed from the OR of the following modes: 

0400 read by owner
0200 write by owner
0100 execute (search in directory) by owner
0070 read, write, execute (search) by group
0007 read, write, execute (search) by others 

A symbolic mode has the form:

 [who]o ppermission[,[who]oppermission] ...

The who part is a combination of the letters u (for user's permissions), g (group) and o (other). The letter a stands for all, or ugo. If who is omitted, the default is a but the setting of the file creation mask (see umask(2)) is taken into account. 

Note: Unlike previous versions of HSI, only one mode string can be specified, which may consist of multiple comma-separated sections, with no intervening whitespace. For example, the following is correct: 

chmod -R go-rwX,u=rwX path ... 



whereas this will fail: 

chmod -R go-rwX u=rwX path ...



The string "u=rwX" will be interpreted as a pathname in the second example. 

Op can be + to add permission to the file's mode, - to take away permission and = to assign permission absolutely (all other bits will be reset). 

Permission is any combination of the letters r (read), w (write), x (execute), X (set execute only if file is a directory or some other execute bit is set), s (set owner or group id) and t (save text - sticky). Letters u, g, or o indicate that permission is to be taken from the current mode. Omitting permission is only useful with = to take away all permissions. 

The octal-constant value is AND-ed with a mask of 0777; values greater than 0777 are silently truncated. 

When the -R option is given, chmod recursively descends its directory arguments setting the mode for each file as described above. When symbolic links are encountered, their mode is not changed and they are not traversed. 

Example: 

chmod 740 Project/file*
chmod u=rwx g+w o=g *.c

Related Command(s): 

CHGRP, CHOWN