linuxd user management, group management

User Management : CentOS system is a multi-user system
users into three categories:
  superuser (root) user id 0
  pseudo-user user id of 1-499, although there are, but not the user logs
  ordinary user to user id 500-60000
users information storage location: / etc / the passwd
  view the file cat / etc / passwd
file content interpretation (linux system, the general profile delimiter : ):
the root: X: 0: 0: the root: / the root: / bin / bash
...

  admin: x: 500: 500: admin: / home / admin: / bin / bash
Detailed:
  Username Password x placeholder user ID for the user ID belongs to the main group described (user alias) directory host command parser
to create a user
Syntax:
  useradd -u user ID -g main user group name -G other group name (may be used, spaced apart) -C user description (alias) users
example (root user only):
  useradd -u 666 -g root - G sys, users, admin -c ' newUser' uqy97a
view the user belongs
  groups uqy97a
view the user information file:
  CAT / etc / passwd
to create the easiest way to user
useradd uqy97b
useradd uqy97c
to back switching users give the user password:
syntax :
  passwd username
example:
passwd uqy97a

Modify the user
to modify the user login name
  usermod = user modify
the syntax:
  user name before the name of the user to modify the usermod -l modification (just modify the login name, home directory does not change)
example:
  usermod -l uqy97b1 uqy97b
modify the user's locked state
  usermod uqy97c -L -L (Lock)
  the usermod -U uqy97c -U (UNLOCK)
delete the user (logged-in users can not be deleted)
syntax:
  userdel -r user name (-r if not, delete user information from passwd but / the user's home directory still exists, -r together with the / home directory delete together)
example:
  userdel uqy97f
see the results:
  CAT / etc / passwd
  LS / home
  userdel -r uqy97e
see the results:
  CAT / etc / passwd
  LS / home
switch users
  su username (root users to switch to the normal user without a password, but the average user to switch to root or other ordinary switch, you need a password)
password syntax:
  passwd username
instance:
  uqy97a the passwd
  the passwd uqy97c
switch user Example:
  SU uqy97a no password
  su root password needed

Group Management: multiple groups centos system
group information storage location: / etc / group
see the document cat / etc / group
file content:
the root: X: 0:
  ADMIN: X: 500:
Explanation:
  group name group password placeholder the group id set a list of users
add a group of
syntax:
  groupadd gqy97a
example:
  groupadd gqy97a
see the results
  cat / etc / group
to delete a group of
  groupdel gqy97b
see the results
  cat / etc / group

Guess you like

Origin www.cnblogs.com/duguangming/p/11116223.html