Let's take a look at an example:
[root@local opt] #ls-al
The Ls-al command is all files that list directories, including hidden files. The filename of the hidden file is the first character '. '
-rw-r--r--1 root root 08-02 14:54 gtkrc-1.2-gnome2
-RW-------1 root root 189 08-02 14:54 iceauthority
-RW-------1 root 08-05 10:02. lesshst
drwx------3 root root 4096 08-02 14:54. metacity
Drwxr-xr-x 3 root root 4096 08-02 14:54 Nautilus
The columns of the list are defined as follows:
[Permission Property Information] [Number of connections] [Owned by] [Owner owned user Group] Size [Last Modified time] FileName
The list of permission attributes is 10 characters:
The first character represents the file type, D is the directory-for the normal file L for connect b for the storage interface device C for keyboard mouse input devices
2, 3, 4 characters for owner permission, 5, 6, 7 characters for owner same group User rights, 8, 9, 10 for other user rights
The second character represents the owner Read permission, or R if it has permission, or-
The third character represents the owner write permission, or W if it has permission, or-
The fourth character represents the owner execution permission, or X if it has permission, or-
The fifth character indicates that the owner has the same group of users Read permissions, or R if they have permission, or-
The sixth character indicates that the owner has the same group of users write permission, or W if the permission is-
The seventh character indicates that the owner has the same group of users to execute the permission, if the permission is x, and no permission is-
The eighth character indicates other read permissions other than the same group, if the permission is R, and no permission is-
The nineth character indicates other write permissions that are not in the same group, or W if they have permissions, or-
The tenth character represents other permissions that are not in the same group, if the permission is x, and no permission is-
To modify a file-owning group command:
[root@local opt] #chgrp [-r] Group name file name
Where-R is recursively set
To modify the owner and group commands for a file:
[root@local opt] #chown [-r] User [: User Group] File name
To modify File access Permissions command:
[root@local opt] #chmod [-r] 0777 filename
Here's a example of setting file permissions for the user
To view basic information about a file:
-~/.BASHRC
-rw-r--r--1 bailing bailing 71901-09 21:08/home/ bailing /. BASHRC
Ls-l output Basic file information:
Output Columns |
Description |
-rw-r--r-- |
File access permissions. |
1 |
The number of hard connections is 1. |
Bailing bailing |
Group and user information for the file attribution. |
719 |
Size of file (in bytes). |
01-09 21:08 |
File modification time. |
/home/bailing/.bashrc |
Filename. |
File access rights
The character of the file access permission is represented by:
character |
Description |
Sample |
- |
Regular files. |
~/.bashrc |
D |
Directory. |
Ls-ld/tmp |
L |
Symbolic connections. |
/dev/stdin->/proc/self/fd/0 |
C |
Character device files. |
/dev/console |
D |
Block device files. |
/dev/sda |
P |
Named pipes. |
|
S |
The socket file. |
/tmp/mysql.sock |
Umask
At the beginning of each file creation, there is a default access right (the file creation mask). The default value for the file is 0666, and the default value for the directory is 0777. The default access rights are affected by umask, and umask limits which permissions should not be granted.
View the value of the Umask (0002 for other not writable):
$ umask
0002
View the symbol representation for umask (-s To view the permissions that can be granted):
- S
u=rwx,g=rwx,o = Rx
Create 1 Files:
$ > /tmp/um.txt $ ls-L/tmp/um.txt-RW-RW-R-- 1bailing bailing0 -- - One: to /tmp/um.txt
Um.txt's initial permission is 0666, whereas Umask is 0002, and the two operations are: 0664, so the final file permission is: 0664 (-rw-rw-r--).
To modify the value of Umask:
$ umask U = rwx , g =, o =
To view the value of the new umask:
$ umask
0077
-S u = rwx, G =, o
=
To create a new file and view permissions:
$ > /tmp/um.txt $ ls-L/tmp/um.txt-RW------- 1bailing bailing0 -- - One:Panax Notoginseng /tmp/um.txt