[Email protected] ~]$ls-Total Al dosage192drwx------. *KANO KANO4096October7 +: -. DRWXR-xr-x.4Root root4096September in -: - .. DRWXRWXR-X.2KANO KANO4096October1 -: to. Aliedit-RW-------.1KANO KANO16384October6 A: +. Bash_history-rw-r--r--.1KANO KANO -January - -. Bash_logout-rw-r--r--.1KANO KANO193October2 One: the. Bash_profile-rw-r--r--.1KANO KANO193October2 One: -. BASHRC
................... Omitted.............
LS is the meaning of [list], and the parameter [-al] is the list of all the files (including the hidden file, which is the first character in front of the file name). As shown above:
Drwxrwxr-x. 2 KANO KANO 4096 October 1: Aliedit
drwxrwxr-x<== file Properties
2<== coupling number
kano<== file Owner
kano<== (the latter) file belongs to group
4096<== file capacity
<== :The last time the file was modified
. aliedit<== file Name
The first column represents the attribute of this file, there are 10.
r
d | TD align= "Center" >
x |
r |
w |
< Span style= "Font-family:microsoft Yahei; font-size:14px; " >x |
r |
- |
< Span style= "Font-family:microsoft Yahei; font-size:14px; " >x |
file type |
readable |
writable |
executable |
&NBSP; |
&NBSP; |
&NBSP; |
&NBSP; |
|
&NBSP; |
|
Attributes of the owner of the file |
Attributes of the group to which the file belongs |
Other people's attributes to this file |
The first attribute indicates that the file is "directory, file, or link files, etc."
- When [d] is the directory
- When [-] is the file
- If [l] is indicated as a link file (link file)
- If [b] is indicated as a storage interface device in the device file
- If [C] is indicated as a serial port device in the appliance file, such as a mouse, keyboard
- When [s] is the data interface file
- When [P] is the data transfer file
In the next attribute, three is a group, where [R] stands for readable (read), [W] for writable (write), [x] for executable (Excute):
- The first group is "owner's permissions"
- The second group is "permissions for the same group"
- The third group is "other non-group (other) permissions"
How to change file permissions
- CHGRP: Change the group that the file belongs to
- Chown: Change file Owner
- chmod: Changing the properties of files, suid, etc.
Change the group you belong to, CHGRP
CHGRP is the abbreviation for Change group. To change the name of the group to be a name that must be present in the/etc/group, the error will be displayed.
chgrp dirname/filename ... Parameter:-r: Continuous change of recursion (recursive), that is, all files and directories under the sub-directory are updated to the meaning of this group.
Change the file owner, Chown
Chown is the abbreviation for change owner. However, it is also important to note that the user must be already present in the system, that is, the record user name in the/etc/passwd file can be changed. Syntax Ibid.
Change nine properties, chmod
There are two ways to set a property, which can be changed by a number or a symbol.
Change file permissions for numeric types
There are nine basic properties of the Linux file, namely the Read/write/excute attribute of the Owner/group/others group, which are three three groups. Where we can use numbers to represent individual attributes,
R:4;w:2;x:1
The same set (Owner/group/others) of three properties (r/w/x) is required to accumulate, for example, when the property is [-rwxrwx---] is:
Owner=rwx=4+2+1=7
Group=rwx=4+2+1=7
others=---=0+0+0=0
So the chmod syntax is
chmod [-R] xyz file or directory parameter: XYZ: is the permission attribute of the number type just mentioned, which is the addition of the numeric value of the Rwx property -chmod777 . BASHRC
Change file permissions for symbol types
chmod |
U G O A |
+ (Join) -(minus) = (set) |
R W X |
File or directory |
User (U)/group and others (G/O)
For example: We want to set the property of a file to [-rwxr-xr-x], so that is
chmod U=rwx,go=rx. BASHRC
If you want to add only. BASHRC this file is writable by everyone, then
chmod a+x. BASHRC
Linux Miscellaneous (vi) file permissions