Automic Workload Automation

Set permissions after file transfer

  • 1.  Set permissions after file transfer

    Posted Jun 20, 2016 03:46 PM
      |   view attached
    Here is an updated version of my solution for setting file permissions after transfer. (You’ll find the attached XML file below.)

    Description
    The objects here provide a way to specify the permissions (mode) of the target file(s) of a file transfer job. The mode is automatically set after the file transfer has been completed.

    Features
    • Capable of setting file modes on both UNIX and Windows.
    • Checks whether the file transfer job was successful before running the job to change the file mode.
    • If wildcards are used, the solution attempts to set the file mode of each successfully transferred file.
    Instructions
    1. Add this line to the top of the Post Process tab of your file transfer job (JOBF):
    :INC SYSTEM.GLOBAL.FT.SET_FILE_MODE.JOBF_POSTPROCESS.JOBI
    2. Create the variable &FT_DST_FILE_MODE# in the Variables & Prompts tab of your file transfer job (JOBF). The format required depends on the target platform. See details and examples for UNIX and Windows below.

    UNIX
    Set &FT_DST_FILE_MODE# to the first argument you would pass to the chmod command
      before the file name. E.g.:
    • 644
    • 4755
    • a+r
    • go-w
    The SET_FILE_MODE.UNIX.JOBS job runs chmod &FT_DST_FILE_MODE# &FILENAME#

    Windows
    Set &FT_DST_FILE_MODE# to the argument(s) you would pass to the Icacls command
      after the filename. E.g.:
    • /grant corp\user1:f
    • /grant corp\myuser:(rx)
    • /grant corp\myuser:(gr,ge,wdac)
      The SET_FILE_MODE.WINDOWS.JOBS job runs icacls &FILENAME# &FT_DST_FILE_MODE#

    Limitations
    • UNIX and Windows are the only supported platforms.
    • On UNIX, the solution supports only ordinary octal or symbolic file modes; it does not support ACLs (yet).
    • This solution does not perform validation of the specified file mode. It simply passes the information set in the variable tochmod (UNIX) oricacls (Windows).
    • This solution performs very basic error handling, attempting to abort cleanly upon encountering errors or unexpected conditions.
    • Wildcards might not work in all cases.
    • This solution has not been tested with file transfers that use theInclude sub-directories option.
    Potential future enhancements
    • Add support for UNIX ACLs viasetfacl command.
    • Add support for z/OS via RACF commands.
    • Add support for changing the owner and group of the file(s).

    Attachment(s)