chmod

Purpose

Changes permissions of a file or list of files.

Syntax and Description

chmod mode file [file ...]

mode can be one of the following forms:

  • { ugo | ug | uo | go | u | g | o | a } {+|- } {r|w |rw}

    a specifies permissions for all users, u specifies permissions for the owner of the file, g specifies the group permissions, and o specifies permissions for other users.

  • { 0|4|6} {0|4|6} {0|4|6}

    The first digit specifies owner permissions, the second digit specifies group permissions, and the third digit specifies other permissions.

Table 10-69 lists the syntax options for the chmod command.


Table 10-69 Options for the chmod command

Option Description

6

Read write permissions

4

Read only permissions

0

No permissions

u

Owner permissions, used with r or w

g

Group permissions, used with r or w

o

Other user permissions, used with r or w

a

All user permissions, used with r or w

+

Add a permission, used with r or w

-

Removes a permission, used with r or w

r

Read permission

w

Write permission

file

Name of a file


This command accepts a file name or multiple file names separated by spaces.

You can only set file permissions to read-write, read-only, and no permissions. You cannot set file permissions to write-only.

If you change the permission settings of an open file, then the operation currently running on the file completes using the old permission settings. The new settings take effect when re-authentication is required.

To view the permissions on a file, use the ASMCMD ls command with the --permission option. See "ls".

Examples

The following are examples of the chmod command that change the permissions of the specified files.

Example 10-78 Using the ASMCMD chmod command

ASMCMD [+fra/orcl/archivelog/flashback] > chmod ug+rw log_7.264.684968167 log_8.265.684972027

ASMCMD [+fra/orcl/archivelog/flashback] > chmod 640 log_7.264.684968167 log_8.265.684972027

ASMCMD [+] > ls --permission +fra/orcl/archivelog/flashback
User      Group      Permission  Name
grid      asm_fra     rw-r-----  log_7.264.684968167
grid      asm_fra     rw-r-----  log_8.265.684972027