Unix and Linux Discussions Tagged with chmod |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
5 |
4,873 |
UNIX for Beginners Questions & Answers |
|
|
|
8 |
3,794 |
Shell Programming and Scripting |
|
|
|
18 |
4,398 |
UNIX for Beginners Questions & Answers |
|
|
|
23 |
17,474 |
Shell Programming and Scripting |
|
|
|
12 |
5,045 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
9,244 |
Cybersecurity |
|
|
|
6 |
9,788 |
Shell Programming and Scripting |
|
|
|
1 |
1,839 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
10,827 |
Shell Programming and Scripting |
|
|
|
4 |
2,316 |
Shell Programming and Scripting |
|
|
|
2 |
40,170 |
Shell Programming and Scripting |
|
|
|
5 |
6,612 |
Shell Programming and Scripting |
|
|
|
2 |
6,849 |
Shell Programming and Scripting |
|
|
|
11 |
5,595 |
Shell Programming and Scripting |
|
|
|
6 |
334,684 |
Tips and Tutorials |
|
|
|
3 |
19,616 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
4,285 |
Web Development |
|
|
|
3 |
7,549 |
UNIX for Advanced & Expert Users |
|
|
|
2 |
10,052 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
5,007 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
6,240 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
11,427 |
SuSE |
|
|
|
3 |
9,595 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
7,802 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
2,721 |
Shell Programming and Scripting |
|
|
|
1 |
7,415 |
Shell Programming and Scripting |
|
|
|
2 |
4,333 |
HP-UX |
|
|
|
1 |
4,392 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
5,459 |
Shell Programming and Scripting |
|
|
|
3 |
17,804 |
Solaris |
|
|
|
3 |
13,087 |
Solaris |
|
|
|
1 |
11,438 |
UNIX for Advanced & Expert Users |
|
|
|
2 |
9,203 |
Shell Programming and Scripting |
|
|
|
2 |
10,960 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,868 |
Shell Programming and Scripting |
|
|
|
33 |
56,997 |
Shell Programming and Scripting |
|
|
|
5 |
13,480 |
Shell Programming and Scripting |
|
|
|
3 |
15,178 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
7,662 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
11,163 |
Cybersecurity |
CHMOD(3) 1 CHMOD(3)
chmod - Changes file mode
SYNOPSIS
bool chmod (string $filename, int $mode)
DESCRIPTION
Attempts to change the mode of the specified file to that given in $mode.
PARAMETERS
o $filename
- Path to the file.
o $mode
- Note that $mode is not automatically assumed to be an octal value, so to ensure the expected operation, you need to prefix $mode
with a zero (0). Strings such as "g+w" will not work properly.
<?php
chmod("/somedir/somefile", 755); // decimal; probably incorrect
chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect
chmod("/somedir/somefile", 0755); // octal; correct value of mode
?>
man 1 chmod' and ' man 2 chmod'.
<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);
// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);
// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);
// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>
RETURN VALUES
Returns TRUE on success or FALSE on failure.
NOTES
Note
The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The
mode can be changed only by user who owns the file on most systems.
Note
This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.
Note
When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the
script that is being executed. In addition, you cannot set the SUID, SGID and sticky bits.
SEE ALSO
chown(3), chgrp(3), fileperms(3), stat(3).
PHP Documentation Group CHMOD(3)