Go to main content

Securing Files and Verifying File Integrity in Oracle® Solaris 11.4

Exit Print View

Updated: August 2018
 
 

How to Change File Permissions Across Symbolic Links

Before You Begin

If you are not the owner of the directory, you must be assigned the Object Access Management rights profile. To change a directory that is a public object, you must assume the root role.

For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.

  1. Change directory permissions in directories and files that are objects of symbolic links.

      Choose one of the following options used with the recursive –R option of the chmod command.

    • –P – Changes the mode of a directory or file unless it is the object of a symbolic link, which prevents the traversal of any symbolic links.

      $ chmod -R -P mode directory | file

      This option is the most secure setting. To see what has changed or not changed and why, add the verbose –v option.

    • –H – Changes the mode of a directory or file that is the object of a symbolic link and the files in the file hierarchy below the directory.

      $ chmod -R -H mode directory | file

      If a symbolic link is found when traversing a file hierarchy, the mode of the target directory is changed but no recursion takes place. To see what has changed or not changed and why, add the verbose –v option.

    • –L – Changes the mode of objects of symbolic links and files by traversing all symbolic links recursively. This option is the default option and is the most permissive.

      $ chmod -R -L mode directory | file

    For more information, see the chmod(1) man page.

  2. Verify that the permissions of all files and subdirectories are correct.
    % ls -lR directory