Lasso Soft Inc. > Home

[File_Chmod]

[File_Chmod] allows the Unix file permissions of a file to be modified. Requires the name and path to the file to be modified, and the new permission sequence as parameters.

The permissions can be specified in several different ways:

- Octal permissions can be specified as a four digit string such as '0777' or '0444'. The octal string should be in the same format used for chmod on the command line.

- Symbolic permissions can be specified using four named parameters -a, -u, -g, -o. Permissions for -a are applied to each of -u, -g, and -o. Permissions for -u are assigned to the owner of the file. Permissions for -g are assigned to the group of the file. Permissions for -o are assigned to others. The values for these parameters should be a string containg 'r', 'w' or 'x' for read, write, and execute permissions. The -a parameter also accepts 's' for setuid/setgid permission and 't' for the sticky bit.

- A Decimal or Hexadecimal value (without quotes) can also be used.

For more information on how chmod permission sequences are interpreted please consult the documentation for your operating system. Some of the details are system dependent.

Note: This tag is currently supported on Mac OS X and Linux.

  • Syntax
  • Parameters
[File_Chmod: File, Permission Sequence]

<?LassoScript

File_Chmod: '/folder/filename.txt', '0777';    // octal (quoted)

File_Chmod: '/folder/filename.txt', -a='rwxst', -u='rwx', -g='rwx', -o='rwx'; // symbolic

File_Chmod: '/folder/filename.txt', -a='rwx'; // symbolic

File_Chmod: '/folder/filename.txt', -u='rwx', -g='r', -o='r'; // symbolic

File_Chmod: '/folder/filename.txt', 511;    // decimal

File_Chmod: '/folder/filename.txt', 0x1f;   // hex

?>
Required Parameters
File The name and path to the file to be modified.
Permission Sequence Decimal or hex chmod permission sequence.
Optional Parameters
-a Permissions for all users (rwxst).
-u Permissions for file owner (rwx).
-g Permissions for file group (rwx).
-o Permissions for other users (rwx).
Examples

To change the Unix file permissons of a file:

Use the [File_Chmod] tag. The following example changes the Unix file system permissions of a file to -rwxrwxr-x (read, write, and execute permissions for the file owner, read, write, and execute permissions for the file group, and read and execute permissions for all other system users).

[File_Chmod: 'myfile.txt', -u='rwx', -g='rwx', -o='rx']
Tag Link [File_Chmod] Category File
Type Process Data Source Any
Support Preferred Version 7.0
Output Type Security File
Implementation Internal Sets Lasso 7.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft