Linux OS is based on the development of UNIX systems, we know that computers are expensive and scarce resources, so a computer to meet multiple users at the same time, that is, the idea of a multi-user system.
Implementation method: Through sharing the policy. That allows multiple users to use a single computer at the same time. This time sharing policy allows the machine to run multiple tasks simultaneously, responding to multiple processes, even if there is only one user.
Linux Multi-user system implementation of the necessary features:
(1) Authentication mechanism: To verify the user ID.
(2) Protection mechanism 1: to fight against bugs, do not let these bad programs block other user programs.
(3) Protection mechanism 2: to fight against malicious programs in case it listens to other users ' activities.
(4) Audit mechanism: To limit the resources assigned to each user.
To ensure the security of the computer, theLinux kernel requires the use of the privileged mode provided by the CPU hardware, while the user program can only run in non-privileged mode. If the user program wants to use the underlying hardware and software resources, it must make a request (interrupt or system call) to the Linux kernel, after the Linux kernel is licensed, and cut into privileged mode to execute.
As in arm processors, the CPSR (current program State Register) uses 5 bits to identify the 7 modes of the processor, two of which correspond to user mode and kernel mode in Linux, while the other 5 modes are used to identify different interrupts or error scenarios.
Users and Groups:
Linux as a multi-user operating system, each user has a private space on the machine, in particular, it will have a quota of disk space to store files, receive private mail messages and so on. Linux must ensure that this part of the private space is visible only to its owners (like bank accounts, of course, to savers themselves), and should ensure that no user can use system applications to infringe on other users ' private spaces (and, of course, not allowing others to move my bank account freely).
In the Linux operating system, all users are identified by a unique user ID (uid->user ID). However, if you choose to share information with other users, the shared user should be a member of one or more groups, this is identified by the group ID (gid->group ID) (several people paid to set up a small company, the company name is GID, our money is a shared resource, Everyone can use and visible). Each file can be associated with an exact group. For example, a user who is a file owner has read and write access to the file, while the other users in the group have access only, and the users in the non-group within the system do not have any permissions (unreadable, non-writable, not executable).
Superuser: In a Linux system, there is a special user---superuser (root), the root user can almost do anything on the Linux system, because the OS does not have a general protection mechanism for it, the root user can access every file on the system, You can manage every user program that is running.
Switching between normal and Superuser: Enter the command on the Linux command line: Su-and then enter the root user's password to switch to the root user, but generally, do not use the root user arbitrarily, because root user error can cause System file loss or system crash.
Linux Multi-user system