I. Rights Management
1. Three types of users:
U: Owner
G: Genus Group
O: Other users
A: All Users
2.chown---Modify the owner of the file
Usage: Chown User name File name or directory name ..., modify directory by default only to change the owner of the directory
-R: Recursively modifies the owner of the file under the directory
--reference=/path/to/somefile file,... Refer to the owner of a file, modify the latter to be the same
Chown username:groupname File,.... Modify the owning group at the same time
- R: Recursively modifies the owning group of the file under the directory
3.CHGRP---Modify the owning group of a file
Usage: CHGRP group name file name or directory name ..., modify directory by default only the group that belongs to the directory
-R: Recursively modifies the owning group of files under the directory
--reference=/path/to/somefile file,... Refer to the group to which the file belongs, modifying the same
4.chmod---Permissions to modify files
Usage: chmod permission value file name or directory name ..., if the number of digits but the previous complement 0
-r: Permission to modify files in directory recursively
--reference=/path/to/somefile file,... Refer to the permissions of a file, modify the latter to the same
chmod u+r File: Add Read permissions for the file owner
chmod u-x File: Remove Execute permissions for file owner
chmod u=rx files: Giving read and Execute permissions to files
chmod ug=rw file: Give read and Execute permissions to file owner and owning group
chmod u=x,g=r File: Grant execute permission to the owner of the file, assign permissions to the owning group
chmod 777 Files: Modify the owner of the file, the group that belongs to, the other person's permissions
chmod +x File: Add Execute permission for three types of files user a omitted
Practice:
1, create a new user without home directory OpenStack;
# useradd-m OpenStack
2, copy/etc/skel for/home/openstack;
# Cp-r/etc/skel/home/openstack
3, change/home/openstack and its internal documents belong to the main group are openstack;
# Chown-r/openstack:openstack/home/openstack
4,/home/openstack and its internal files, group and other users do not have any access rights
# chmod-r go=/home/openstack
Issue: How to add a user manually by adding a user Luochen Basic group Luochen (GID 1000) additional group test without the Useradd command
1. Add a line to the end of the/etc/group file
luochen:x:1000:
Add Luochen to the last field in the test group
2. Add a line to the end of the/etc/passwd file
Luochen:x:1000:1000:luochen:/home/luochen:/bin/bash
3. Add a line to the end of the/etc/shadow file
luochen:!! : 16539:0:99999:7:::
4. Copy home Directory
Cp-r/etc/skel/home/luoche
5. Specify the group to which the file and directory owner belongs
Chown-r luochen.luochen/home/luochen/
6. Delete the owning group and other people permissions
Chmod-r go=/home/luochen/
7. Generate a password
OpenSSL passwd-1-salt ' Luocheng '---1 bits using MD5 encryption-salt to encrypt impurities 8 bits
Copy the generated password into the/etc/shadow file
5.umask Command---Matte code
Determines the default permissions when a user creates a file or directory the system automatically adds 1 if you have Execute permissions when you calculate it must not let the file have permission to execute
The current mask code can be viewed directly with umask
Use Umask 0xxx to set mask code
The type of shell that stands in terms of user login:
Log-in Shell:
Normal usually a terminal Login
Su-username
su-l USERNAME
Non-logon Shell:
su USERNAME
Open Command window under graphics terminal
shell scripts that are executed automatically
Bash configuration file:
Global configuration
/etc/profile,/etc/profile.d/*.sh,/ETC/BASHRC
Personal configuration
~/.bash_profile, ~/.BASHRC
File for Profile class:
Setting Environment variables
Run a command or script
Files of the BASHRC class:
Setting Local variables
defining command aliases
How does the login shell read the configuration file?
/etc/profile--/etc/profile.d/*.sh--and ~/.bash_profile--~/.BASHRC--/ETC/BASHRC
How do I configure a file for a non-logon shell?
~/.BASHRC--/ETC/BASRC-/etc/profile.d/*.sh
The full and half switch of the SU command is whether to read the environment configuration of the switching user
Command aliases used across shells
Add alias Cls=clear to the. bashrc file in your home directory to save and log in to use
To display some information when a user logs on, you can write a script in the. bash_profile file
This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1634856
Introduction to basic commands under Linux (vi)