Why servers, especially large servers, use Linux systems
Servers, especially large servers, typically use a Linux system for the following reasons:
1, low cost, Linux operating system is free
2, security, Linux has taken a number of security measures, including read and write rights control, with protection subsystem, audit trail, core authorization, etc., for users in the network multi-user environment to provide the necessary security protection
3. Powerful network, Linux in communication and network functions better than other operating systems
4, open source, which means that the administrator can be arbitrarily customized system
Concepts of Linux users and groups
1. Users
A user is a collection of permissions that can get system resources
2, Linux User Group classification
(1) Administrator root: Users with all rights to the system, UID 0
(2) Ordinary users: that is, the general user, the use of the system has limited access to the UID between 500-60000
(3) System users: Protect the system operation of users, generally do not provide password login system, UID between 1-499
3, the user-related documents
(1)/etc/passwd
The format is Account:password:UID:GID:GECOS:diretory:shell
A) account indicates user name or accounts
b) password represents the user password placeholder
c) UID indicates user ID number
D) GID indicates the ID number of the group in which the user is located
E) diretory indicates the home directory where the user resides
f) shell indicates the programming environment in which the user resides
I have a ubuntu12 in my own house. The contents of this file are:
(2)/etc/shadow
The format is Account:password: the date the password was last changed: the number of days the password cannot be changed: the number of days the password needs to be changed: the warning period before the password change: grace period for password expiration: Account expiration Date: retention
4. User Group classification
(1) Normal user group: can join multiple users
(2) System group: Generally add some system users
(3) Private group: When a user is created, if the owning group is not specified for it, a private user group is defined, with the name of the user name. If you add another user to the private group, the private group becomes the normal group
Same permissions as group of users
5. Files related to user groups
/etc/group, which is in the format group_name:password:GID:user_list
(1) group_name = Group Name
(2) password indicates group password
(3) GID represents group ID number
(4) User_list represents a list of users who have been group_name as additional groups
The difference between Su and sudo
1, Su
Su is the tool to switch users. For example, user a login, but to add user tasks, the execution of the Useradd,a user does not have this permission, and this permission is exactly root. The solution is nothing more than two, one is to exit a, log in as root, and the other is to switch to root via Su, and then exit root when the task is completed.
Note that the "Su" and "Su-" are also switched to the root user, and there is a difference between the two. The former simply switches the root identity, but the shell environment is still a normal user's shell, which, in conjunction with the user and shell environment, switches to root. The PATH environment variable error cannot occur unless you switch the shell environment, and can be verified by the PWD command.
SU does give management convenience, by switching to root, can complete all system management, as long as the root password to any ordinary user, he can switch to root to complete all system management work. However, it is not safe to switch to root via Su, which can cause system crashes or data loss as long as there is any one person operating error during multi-user operation.
2. sudo
With Sudo, we can put some super-privileged under the targeted, and do not need ordinary users to know the root password, so sudo is more secure than the unrestricted-access Su, so sudo is also known as the restricted Su. In addition sudo is required to be licensed, so it is also referred to as a licensed Su.
The process for sudo to execute a command is that the current user switches to root (or another user who performs the switch to), then executes the command as root (or another user who performs the switch), and then returns to the current user directly after execution is complete. The premise of this is to use sudo config file/etc/sudoers to authorize.
File permissions
I intercept my own list of files under a path under Ubuntu:
Explain in detail:
1. The first column indicates the type and permissions of the file/folder
(1) The first character indicates the type of file, "D" means the Directory, "-" indicates a normal file
(2) The second to the fourth character indicates the permissions of the file/folder owner, R for Read permission, W for write permission, and X for execute permission
(3) Fifth to seventh characters indicate the permissions of the group to which the file/folder belongs, R for Read permission, W for write permission, and X for execute permission
(4) Eighth to tenth characters represent permissions for other users of a file/folder, R for Read permission, W for write permission, and X for execute permission
2, the second column indicates the number of connections to the File/folder
3. The third column represents the owner of the File/folder
4. The fourth column indicates the group to which the file/folder belongs
5. The Fifth column indicates the file/folder size
6. The Sixth column indicates the last modified time of the file/folder
7. The Seventh column indicates the file/folder name
Linux1:linux Overview