Child pages
  • cPanel API 1 Functions - Fileman::changeperm

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function changes a file's permissions.

Include Page
LIB:_cPanelAPI1NoEquivalent
LIB:_cPanelAPI1NoEquivalent

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledFileStorageRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$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.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
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.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

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



Expand
titleCommand Line


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

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote


Expand
titleOutput (plaintext)


Code Block
languagetext
"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.