Changes the access permissions (read, write, execute) of files or directories.
First available in version 3.0 build 2039.
mode - The new file permission settings.
remotePath - The name of the file or directory to change.
errorDetails - Raw error code and description from the FTP server.
When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.
The mode consists of three octal (base 8) digits.
The value of each digit represents the type of access that is allowed:
- Digit Read (r) - Write (w) - Execute (x)
- 0 No - No - No
- 1 No - No - Yes
- 2 No - Yes - No
- 3 No - Yes - Yes
- 4 Yes - No - No
- 5 Yes - No - Yes
- 6 Yes - Yes - No
- 7 Yes - Yes - Yes
The position of the digit in the mode represents who the permission applies to: user (you), your group (users set-up on your account), and other (everyone else). This table shows some commonly used mode values:
- User - Group - Other Permissions Example Use
- 7 - 5 - 5 rwx r-x r-x directories containing CGI files
- 7 - 7 - 7 rwx rwx rwx directories not containing CGI files
- 7 - 5 - 5 rwx r-x r-x CGI files (readable by everyone, executable by everyone)
- 6 - 6 - 6 rw- rw- rw- log files
- 7 - 7 - 7 rwx rwx rwx HTML files
Note: You can't use CHMOD to set or change the "directory bit".
The following example sets the permissions for the files directory so that only reading is allowed.