Lasso Soft Inc. > Home

[ filedesc->fchmod ]

Method

[filedesc->fchmod] changes the unix file permissions of a file. The permissions may be expressed in either octal or decimal notation.

  • Syntax
file object->fchmod(octal notation)
file object->fchmod(decimal notation)
Examples
  • Intermediate

To change the Unix file permissons of a file:

Use the [filedesc->fchmod] 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).

Code

local(f) = file('/path/to/file.txt');
#f->fchmod: '0775'; // using octal notation
#f->fchmod: 509; // using decimal notation

Recent Comments

Note: to use permissions as you would enter them in the terminal, you need to use 4 digit octal codes. You can set rw-rw-r-- using 664 in terminal, but Lasso requires that to be 0664. If you only use 3 digits, it's interpreted as a decimal value which is then converted to octal. In this case you'd need to use 436 (436 decimal = 664 octal).

For directories where you'd want rwxrwxr-x, use 0775 (octal) or 509 (decimal)

Posted on: 20 June 2011

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