Control of file permissions and control of processes and services

Source: Internet
Author: User

Control of a file's permissions
1. Meaning of the existence of authority
R: Can read the actual contents of the file
W: can edit, add or modify the contents of the file, if there is no r permission. Cannot be W
X: The file has the power to be executed by the system
2. Recognition of permissions
Ls-l file
View the details of a file


Ls-ld dir
To view the details of a directory

    1. View and understanding of permissions
      File permissions)
      • rw-r--r--1 root root 216 may 2017/mnt/rht
        "1" File type
      • Normal file
        Catalog D
        L Soft links (similar to shortcuts under Windows)
        s socket
        C-Character Device/dev/pts/
        "2" rw-|r--|r--what individual users can do with files
        U g o
        User members Others
        "3" File hard link, the number of times the file content is recorded by the system
        "4" File owner
        "5" File owning Group
        "6" File size
        "7" The last time the file was modified
        Name of the "8" file

Permissions for the Directory
D rwxr-xr-x. 2 root root 4096 Jul 09:05/mnt/
"1" File type
"2" permission
Number of subdirectories in "3" directory
"4" User
"5" group
"6" sub-file or subdirectory metadata size (metadata: Data that describes the data)
"7" Time of Last modification
"8" name

4. How to modify file users and user groups
(1. This command must be performed by the root user
Chown Username/mnt/file1 # #将file1文件的拥有人改为username


Chown-r Username Dir # #将dir目录和目录下文件的所有人全都改为username

Chown Username:username File|dir # #将file文件或者dir目录的拥有人和用户组改为username

Chgrp username/mnt/file2 Change file2 user group to username

Chgrp-r Username/mnt/dir Modify the dir directory and the user group of the files in the directory to username

5. File permissions
1) Role of file permissions
R
Whether the file can view characters in the file
Whether the directory can see what files are in the directory
W
Whether the file can change the characters recorded in the file
When you manage files in the directory maliciously in the directory, can you change the metadata of the files in the directory
X
A program that can invoke files within a file by file name
Whether the directory can enter this directory
2) Management of permissions
Character form
chmod <ugo> <+-=> <rwx> file|dir


Digital Way
Rwx
210
x=20*0|1=0|1
w=2*10|1=0|2
r=2
2*0|1=0|4

X=1
w=2
R=4

Rwx=7
Rw-=6
R-x=5
R--=4
-wx=3
-w-=2
--x=1



6. Permissions List
Specific users have specified permissions on specific files
-rw-r--r--+ 1 root root 216 may Rht
Setfacl-m u:username:rwx file to set permissions

GETFACL file permission information to get files

File:file file name

Owner:root file Owner

Setfacl-x u:username file removes the special user from the


Setfacl-b File Close Permissions List


Control of processes and services
1. What is a process
Programs that are in progress in the system
2. How the graphics process is viewed
Gnome-system-monitor

3. View the commands for a process
PS Viewing process

A current process-related process (contains information about the current environment itself)

-a displays all processes in the current terminal (without the current environment itself information)

-A|-E System All Processes


x contains all processes containing the terminal (must contain a TTY (character output device))

F Viewing the dependencies of a process


Everyone of the U-process

PS ax-o comm,nice,%cpu,%mem,pid,user,group,stat View ...

PS Ax--sort=%cpu default to ascending order

PS Ax--sort=-%cpu Descending order

4. Priority of the process
-20 ———— 19
The smaller the number, the greater the priority.
Renice-n 5 2580
S Process State
s This process is a top-level process
The T process is temporarily stopped
High priority of the process
The ' empty ' process has a normal priority
N-Process Priority low
L process has lock space in memory

Renice-n-5 PID Specifies the priority of the modification process

Nice-n-5 Command & Assign priority to open a process

5. Calls to and from the process
CTRL + Z will occupy the terminal process into the background stop

Jobs View all processes temporarily suspended in the current background

BG Jobsnum to run the specified process in the background

FG Jobnum Returning the specified process to the foreground

CTRL + C will consume the current terminal's process end

6. Signal
1 reloading the configuration without stopping the process
2 Purging process in-memory data
3 clearing the mouse's in-memory data
9 forcibly ending a process

15 Normal shutdown process (will block)

18 Running a stopped process

19 Suspend process (cannot be blocked)


20 Pause process (can be blocked)

Kill Signal PID
Killall Signal Process Name
IP addr Show Br0 real machine query the IP address of this machine

Ifconfig eth0 Virtual Machine Query the IP address of this machine

7. Control of the service
Systemctl Start Sshd.service Open

Systemctl Stop Sshd.service Stops

Systemctl Status Sshd.service View status

Systemctl Retart sshd.service Restart

Systemctl Enable Sshd.service Boot

Systemctl Disable Sshd.service shutdown self-starter

Systemctl list-units List Current system-enabled services

SYSTEMCTL list-unit-files list service boot status in the system

Systemctl Mask sshd

Systemctl unmask sshd

Systemctl
Level has 0-6, 0 is shutdown, 6 is restart, 234 is no graphical interface, 5 is a graphical interface
W See who is currently using this computer.

Control of file permissions and control of processes and services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.