Go to main content

Securing Files and Verifying File Integrity in Oracle® Solaris 11.3

Exit Print View

Updated: October 2017
 
 

How to Change File Permissions in Absolute Mode

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

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

    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.

    filename

    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 Chapter 2, Using ACLs and Attributes to Protect Oracle Solaris ZFS Files in Securing Files and Verifying File Integrity in Oracle Solaris 11.3.


  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 the following 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    6023 Aug  5 12:06 public_dir
# chmod 755 public_dir
# ls -ld public_dir
drwxr-xr-x  1 jdoe   staff    6023 Aug  5 12:06 public_dir

In the following 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    6023 Aug  5 12:06 my_script
% chmod 700 my_script
% ls -l my_script
-rwx------ 1 jdoe   staff    6023 Aug  5 12:06 my_script