return value of program output
Standard output return value: 0
Standard error Output return value: 1-255
echo $? To get the return value
/dev/null: Device data (data black hole)
Can output useless information to/dev/null such as Ls/var &>/dev/null
Set-c: Prompt the user before overwriting
Users & Groups: Core elements to achieve resource allocation
Groups: Containers for users and permissions, easy to manage users with the same permissions
Categories of users:
Admin Administrator ID is 0
System User 1-499 is non-interactive, deamon, similar to the service in win.
Users 500 after normal user
--UserID (numeric) /etc/passwd/storing user information
/etc/shadow: Store password
/etc/group
Password for the/etc/gshadow group
Resolution of name resolution user name and user ID
Group ID with User ID
Management Group 0
System Group 1-499
General user Group
3A Certification:
Authenticatioin: Password Vault
Authorization: Through the genus Master Group to achieve
Audit, through the operation log to achieve
Permissions: All Documents
File:
R
W
X:excute, the permissions that are submitted to the kernel to run,
Directory:
R: Can LS
W: Create or delete
X: You can CD to the directory, or LS to display the directory metadata information
Ls-la nine-bit permissions, owner, group, three other users
Permission matching mode when a user accesses a file: (mode)
1, whether the owner of the process is running in accordance with the owner of the file, is the main permission to run, otherwise enter the STEP2,
2, check whether the group is consistent, otherwise enter the STEP3
3, execute AS other user
Password file:
/etc/shadow
The format needs to know 7 fields separated by a colon
Account:passwd:UID:GID (Basic Group): GECOS (optional,comments):
Directory (home directory): Shell (user's default shell)/etc/shells
Group to which the user belongs:
Basic Group;
Additional groups (additional groups)
Useradd
Useradd USER1
Ls-l ' which useradd ' which adduser
If a base group is not specified when it is created, a group with the same name as the user is created as its base group. (Private Group)
Options
-u:uid Specify User ID useradd-u 888 USERNAME
-g:gid Specify basic group Useradd-g Testgroup or 888 USER
-G: Specify additional groups
-c:comment, add comment information
-D: Home directory, if this directory exists beforehand, there will be warning, copy/etc/skel (skeleton)
Useradd-d/tmp/test/user
-S: Specifies one of the shells,/etc/shells, using the absolute path
Useradd-s/bin/tcsh USER echo $SHELL view
-M: Do not specify user home directory
-r: Create system User (not logged in user, so no home directory)
Groupadd:
Three colon-delimited 4 fields/etc/group
GROUPNAME:PASSWD (dot character x): Gid:user_list (seperated by comma as an additional group)
Option
-g:gid
-R: System Group
Groupdel
Userdel
Linux User and Group management