Assalamualaikum wr.wb
Untuk mengubah hak akses sebuah file atau folder dapat digunakan perintah chmod, adapun rincian penjelasan perintah ini adalah sebagai berikut:
chmod change access permissions of a file
chmod [-fR] mode pathname ...
DESCRIPTION
chmod changes the access permissions or modes of the specified files or directories. Modes determine who can read, change or execute a file.
Options-
f does not issue error messages concerning file access permissions, even if chmod encounters such errors.
-
R changes the access permissions of all files and subdirectories under a directory if one is specified as a path name on the command line.
ModesYou can specify the mode value on the command line in either symbolic form or as an octal value.
A symbolic mode has the form
[who] op permission [op permission ...]
The who value is any combination of the following:
u sets user (individual) permissions.
g sets group permissions. o sets other permissions. a sets all permissions; this is the default.
On Windows file systems, there are no group or other permissions. Therefore, they always match the individual permissions.
The op part of a symbolic mode is an operator that tells chmod to turn the permissions on or off. The possible values are:
+ turns on a permission.
- turns off a permission.
= turns on the specified permissions and turns off all others.
The permission part of a symbolic mode is any combination of the following:
r read permission. If this is off, you cannot read the file. The extended FAT and NTFS file systems ignore this permission since all files are always readable.
x Execute permission. If this is off, you cannot execute the file. The extended FAT and NTFS file systems ignore this permission since they consider all files executable.
X Execute/search permission for a directory; or execute permission for a file only when the current mode has at least one of the execute bits set. The extended FAT and NTFS file systems ignore this permission since they consider all files executable and all directories searchable.
w Write permission. If this is off, you cannot write to the file.
h Hidden attribute. Only the extended FAT and NTFS file systems recognize this attribute.
a Archive bit. Only the extended FAT and NTFS file systems recognize this attribute.
s On POSIX-compliant and UNIX systems, this stands for setuid on execution or setgid on execution permission. On Windows systems, this stands for a system file.
S On NTFS 5.0 (and up) file systems (available only on Windows NT/2000/XP/2003/Vista/7/2008 system), this is the sparse file bit. Due to limitations in the file system, once you have set this attribute, you cannot turn it off without recreating the file.
t On UNIX systems, this stands for the sticky bit. On Windows NT/2000/XP/2003/Vista/7/2008, it refers to the temporary file bit.
c Compressed file attribute.
You can specify multiple symbolic modes if you separate them with commas.
Absolute modes are octal numbers specifying the complete list of attributes for the files; you specify attributes by OR'ing together these bits.
01000000 temporary file
02000000 compressed file
04000000 sparse file
4000 Hidden file (setuid bit)
2000 System file (setgid bit)
1000 Archive bit (sticky bit)
0400 Individual read
0200 Individual write
0100 Individual execute (or list directory)
0040 Group read
0020 Group write
0010 Group execute
0004 Other read
0002 Other write
0001 Other execute
This list shows the first three bits with their meanings on Windows systems and with their meanings on UNIX and POSIX-compliant systems in parentheses. The MKS version of chmod tries to handle options in a way that parallels the POSIX approach. In the following list, each line shows a group of calls that are equivalent.
chmod 0000 chmod o=s
chmod 2000 chmod g=s chmod =s
chmod 4000 chmod u=s chmod =h
chmod 6000 chmod a=s chmod ug=s chmod =hs
Note:
=s is equivalent to 2000 on Windows systems; on UNIX and POSIX-compliant systems, =s is equivalent to 6000. MKS intends these equivalences to support commands ported to Windows from UNIX or POSIX-compliant systems. Such ported commands do not do the same thing that they do on UNIX or POSIX-compliant systems, (since Windows systems do not have the same file attributes as UNIX and POSIX), but the commands work in a consistent manner.
To get a read-only file on Windows systems, you must turn off all three write permission bits; if any of the three is on, Windows considers the file to be writable.
On Windows systems, the lc and ls commands both indicate the mode settings of files. The Windows dir command does not show these attributes, and the attrib command may only work with the read-only attribute, depending on the version of your operating system.
EXAMPLESchmod -w nowrite --> makes file nowrite read-only.
chmod +hrs sysfile --> sets the hidden, read-only, and system attributes for sysfile.
chmod a=rwx file --> turns on read, write, and execute permissions, and turns off the hidden, archive, and system attributes. This is equivalent to
chmod 0777 file
On Windows NT/2000/XP/2003/Vista/7/2008, the command
chmod -R +c d:/ --> compresses the D: drive.
DIAGNOSTICSPossible exit status values are:
0 --> Successful completion.
1 --> Failure due to any of the following:
- — unable to access a specified file
- — unable to change the modes on a specified file
- — unable to read the directory containing item to change
- — encountered a fatal error when using the -R option
2 --> Failure due to any of the following:
- — missing or invalid mode argument
- — too few arguments
Messagesfatal error during "-R" option
You specified the -R option but some file or directory in the directory structure was inaccessible. This may happen because of permissions or because you have removed a removable disk unit.
read directory "name"
You do not have read permissions on the specified directory.
NOTEchmod is provided as both an external utility and a built-in MKS KornShell utility.
ok, semoga bermanfaat.