Linux-- users and groups --02

User Management:

1, useradd to create the user

- C specified user description 
- D designated home directory 
- G specify the group 
- G specify additional group can have a plurality of sets of additional  special program to specify shell -s / sbin / nologin -> does not allow a user login  - U UID specified -m not create home directory

2, userdel Delete user

-r delete a directory with family

3, usermod modify user

- C Modify User Description 
- D modifying (create) home directory 
- G modify the primary set 
- G Additional modifications group  - m Mobile home directory modifications  -o allows the same UID and - used with modified UID u -u

4、passwd

- L lock password 
- U unlock 
- d delete password 
echo "password" | passwd -stdin "username"

5, group management

gropadd Add Group 
  - G Modify Group ID 
  - O reuse allowed 
groupdel delete group 
groupmod modifying group 
  - G <Group ID> Set group ID to be used is    - O group identifier code reuse    - n-modifying group name specified -p set password

6, popular file

/ etc / the passwd 
  the uname : X: UID: GID: Description: home directory: shell program 
/ etc / Shadow 
  the uname : UID: Password: various time 
/ etc / Group Group File    Group: Group Password: Group ID: Additional Group  / etc / gshadow group password file    uname : password: user group administrator name: support account name / etc / skel 
  by default, files in this directory will be copied to each ordinary user's home directory, generally used to make caveat

7, user rights

R & lt   . 4   Read
 W   2   Write 
X   . 1   performs 

the chmod [A | G | O | U] [+ | - ] Add a file or delete permissions
 chown : User file modification belonging group
 chown User: file modification master belongs
 chown User: User file modification belongs main group and belongs

8, acl license management

setfacl add permissions 
  setfacl - MU: user: rw rw rights users to add a file called 
  setfacl - xu: Username Cancel file permissions 
getfacl 
  view acl permission to add

9, special privileges

Temporary permission to borrow, for example: there are two users belong to AB group AA and BB groups; creates a a.txt A, B default access a.txt continue to use other authority; when privileges A B wants to borrow visit a. txt; SUID must be set to 1; also can borrow the SGID permission to access files; 
SUID 
  chmod + U S special privileges granted to SUID file name, and if the owner has permission to display x s, x is not displayed S. 
SGID 
  chmod G + S special permission granted SGID file name, if there is a set of permissions displayed as x s, x is not displayed S. 
Sticky sticky bit, authorize a directory, all users can delete their own files in the directory, you can not delete other people's files. 
  chmod o + t directory sticky bit permissions granted to the file, if there are other people permission to appear as x t, x does not display T.

10, su Authorization

/ Etc / sudoers in this file inside to add permissions to

 

Guess you like

Origin www.cnblogs.com/gxnihao/p/11431246.html