Description

This function changes a file's permissions.

Examples




$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$change_file_permissions = $cpanel->api1('Fileman', 'changeperm', array('account', 'my_file.txt', '4', '2', '1', '4', '2', '1', '4', '2', '1', '0') ); // Call the function.



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $change_file_permissions = $cpliveapi->api1('Fileman', 'changeperm', ['account', 'my_file.txt',  '4', '2', '1', '4', '2', '1', '4', '2', '1', '0']); # Call the function.


<cpanel Module="Fileman::changeperm ( $FORM('dir','file','userread','userwrite','userexecute','groupread','groupwrite','groupexecute','worldread','worldwrite','worldexecute','doubleencode'))">




cpapi1 --user=username Fileman changeperm public_html myfile.txt 4 2 1 4 2 1 4 2 1



"Set permissions on index.html -> 0755"




Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

The file's directory.

This value defaults to the cPanel account's /home directory.

Any valid directory, relative to the account's /home directory.

public_html
filestring

Required

The file.

Any valid filename.

 

myfile.txt
userreadinteger

Required

The user's read permissions.

  • 4 — Grant read permissions.
  • 0 — Do not grant read permissions.
4
userwriteinteger

The user's write permissions.

This value defaults to 2.

  • 2 — Grant write permissions.
  • 0 — Do not grant write permissions.
2
userexecuteBoolean

The user's execute permissions.

This value defaults to 1.

  • 1 — Grant execute permissions.
  • 0 — Do not grant execute permissions.
1
groupreadinteger

Required

A group's read permissions.

  • 4 — Grant read permissions.
  • 0 — Do not grant read permissions.
4
groupwriteinteger

Required

A group's write permissions.

  • 2 — Grant write permissions.
  • 0 — Do not grant write permissions.
2
groupexecuteBoolean

Required

A group's execute permissions.

  • 1 — Grant execute permissions.
  • 0 — Do not grant execute permissions.
1
worldreadinteger

Required

Any system user's read permissions.

  • 4 — Grant read permissions.
  • 0 — Do not grant read permissions.
4
worldwriteinteger

Required

Any system user's write permissions.

  • 2 — Grant write permissions.
  • 0 — Do not grant write permissions.
2
worldexecuteBoolean

Required

Any system user's execute permissions.

  • 1 — Grant execute permissions.
  • 0 — Do not grant execute permissions.
1
doubleencodeBoolean

Whether to encode the file and dir values in a URL format.

This value defaults to 0.

  • 0 Do not encode the file and dir values in a URL format.
  • 1 Encode the file and dir values in a URL format.
0

Returns

This function returns a message of success or a reason for failure.