Go to main content

Securing Files and Verifying File Integrity in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020

How to Change File Permissions in Absolute Mode

In this procedure, a user changes permissions on a file that the user owns.

  1. Change permissions in absolute mode.
    % chmod nnn filename

    Specifies the octal values that represent the permissions for the file owner, file group, and others, in that order. For the list of valid octal values, see Figure 4, Table 4, Setting File Permissions in Absolute Mode.


    Specifies the file or directory.

    Note -  If you use the chmod command to change file or directory permissions on objects that have existing ACL entries, the ACL entries might change as well. The exact changes are dependent upon the chmod permission operation changes and the file system's aclmode and aclinherit property values.

    For more information, see the "ACL Operation" section of the chmod(1) man page and Setting ACLs on ZFS Files.

  2. Verify that the permissions of the file have changed.
    % ls -l filename

    Note -  If you are not the owner of the file or directory, you must be assigned the Object Access Management rights profile. To change a file that is a public object, you must assume the root role.
Example 4  Changing Permissions in Absolute Mode

In this example, the administrator changes the permissions of a directory that is open to the public from 744 (read, write, execute; read-only; and read-only) to 755 (read, write, execute; read and execute; and read and execute).

# ls -ld public_dir
drwxr--r--  1 jdoe   staff    6K Aug  7 12:06 public_dir
# chmod 755 public_dir
# ls -ld public_dir
drwxr-xr-x  1 jdoe   staff    6K Aug  7 12:06 public_dir

In this example, the file owner changes the permissions of an executable shell script from read and write to read, write, and execute.

% ls -l my_script
-rw------- 1 jdoe   staff    6K Aug  7 12:06 my_script
% chmod 700 my_script
% ls -l my_script
-rwx------ 1 jdoe   staff    6K Aug  7 12:06 my_script