Vim:
/ETC/PASSWD User Information
Form: User name: Password (x): Uid:gid: User description: User home directory: User shell
/etc/group User Group Environment
Form: User name: Group password: Group ID: Additional Member
/etc/shadow User authentication information file (password)
Form: User name: Authentication encryption character (encrypted password): Last Modified time: password minimum validity period (this period of time do not change password): Maximum validity period (must change password): Warning Period: Waiting period: expiry date:
/etc/skel/. * User Environment settings file
/home/username Home Directory
########## #用户操作命令 ################
ID View user Information
Id-u # # #用户uid
-G # # #用户gid
-A # # #用户所有信息
-G # # #用户所在所有的id
-un # # #用户名字
-GN # # #用户初始组名称
-GN # # #用户所在所有组名称
Su-username # # #切换用户用户所使用的环境
Echo $PATH # # #查看当前用户的用户环境
Echo $USER # # #显示当前用户的信息su-Switch user identity and user environment
Su only switches user identities
Useradd # # #新建用户
-U # # #指定用户的uid
-G # # #指定用户初始组, this group must exist
-G # # #指定附加组, the same group must exist
-C # # #用户说明
-D # # #指定用户加目录
-S # # #指定用户使用的shell, Shell category see/etc/shells
Userdel-r # # # #删除用户 (Be sure to add-r)
GROUPADD-G # #新建组,-G indicates the ID of the specified group
Groupdel # # #删除组
passwd # # #更改用户密码
To view the commands used by the user establishment or management process
Watch-n 1 ' tail-n 3/etc/passwd;tail-n 3/etc/group '
Watch-n 1 tail-n 3/etc/passed/etc/group # #时时监控用户信息的后三组
To modify user properties individually:
User name: Password (x): Uid:gid: User description: User home directory: User shell
Usermod-u User name-Change UID
-u # #改变用户uid
-g # #改变用户初始组
-G #改变用户附加组
-aG # #增加用户附加组
-d # # change user add directory information
-md # #改变用户加目录信息和加目录名称
-s #l # Change the user's Shel
-c #改变用户的说明
-L # #冻结用户
-U # #解锁用户
################## #用户权限下放 (sudo) ##################
Permission to move a configuration file
/etc/sudoers
This file is edited with the Visudo command
1.visudo
Search to 99 rows
Add statement
User name localhost= (root) nopasswd:/usr/sbin/useradd
Document content:
Authorized target User Host name = (new user authorized by user) authorize user to execute command
Example:
# # #test用户能在localhost主机执行useradd (to test password)
Test localhost= (Root)/usr/sbin/useradd # # #localhost是主机的hostname
# # #test用户能在localhost主机执行useradd (don't ask for a test password)
Test localhost= (Root) nopasswd:/usr/sbin/useradd
2. Sample test
Su-test
sudo useradd username
ID Username # #查看用户信息, confirm user successfully created
######################### #密码期限更改 ###################
Individually modified authentication information (password information)
User name: Authentication encryption character (encrypted password): The last time modified: password minimum validity period (this period of time not to change the password): Maximum validity period (must change password): Warning Period: Waiting period: expiry date:
Chage
-D User Name change the last time the password was modified (0) The password will be enforced at login
-m Change password the minimum validity period is usually 0 to a few days can not change the password
-m change password the longest period of time is changed to a few days after the password must be changed
-W Change warning period
-I change non-active days expire extension period
-E Change Password expiration date
############## #权限的设定 ########################
1. File Properties View
ls-l filename
-rw-rw-r--1 Kiosk Kiosk 0 Oct 2 17:05 file
File type file permissions file copy number file owner file All group size last modified time name
2. View Directory Properties
Ls-ld Directoy
D rwxr-xr-x 3 Kiosk kiosk 09:47 Directory
Type Permissions subdirectory Directory owner directory all group sub-file attribute size directory contents Change directory name
3. Changes to the file user group
Chown User name File # #更改文件所有人
CHGRP group name File # #更改文件所有组
Chown-r User Directory # #更改目录本身以及目录中的子文件的所有人
CHGRP-R Group name Directory # #更改目录本身以及目录中的子文件的所有组
4. Recognition of permissions
Ls-l in 2-10 characters for file permissions
RWX r-x R-x
User rights group member permissions other user rights
Types of permissions
R
R permissions for files, which means you can view the contents of a file
R permissions for the directory, which means that you can view the file names that exist in the directory
W
W permissions against the file, indicating that the contents of the file can be changed
W permissions for the directory, indicating whether sub-files or subdirectories in the directory can be deleted
X
X permission for the file, indicating whether the program that is logged in the file can be opened
X permission for the directory, indicating whether it can be entered in the directory
chmod ugo+-=rwx # #改权限
U=rwx=7 |g=rwx=7 |o=rwx=7
421
U=rw-=6 g=r--=4 o=r--=4 644
R=4
w=2
X=1
-=0
7=rwx,6=rw-,5=r-x,4=r--,3=-wx,2=-w-,1=--x,0=---
5. Default permissions for Files
Umask # #显示系统预留权限值
VIM/ETC/BASHRC 71 is a change for a normal user, and 73 is a super user change
Vim/etc/profile 60 is a change for a normal user, and 62 is a super user change
SOURCE/ETC/BASHRC # #刷新bash配置
Source/etc/profile # #刷新系统配置
6. Special Permissions
Stickyid # # #强制位
O+t # # #之针对目录, when a directory has T permissions, the files in this directory can only be deleted by the owner of the file
T=1
chmod o+t Directroy
chmod 1777 Directory
Sgid # # #粘制位
G+s # #针对目录, files created in the directory are automatically attributed to the group in which the directory is located, and for binary files, the program that is logged within the file does not have a relationship with the performer's group identity at execution time, but rather as the identity of all the groups in the binary file.
chmod g+s File|directory
chmod 2777 File|directory
SUID # # #冒险位
U+s # # #针对文件, file record actions are performed as a file owner when executed, regardless of who originated it.
chmod u+s File
chmod 4777 Fileg+s
Linux Related settings for users