Linux Learning (User Management)

Linux is a multi-user operating system, the introduction of users, you can easily manage Linux server, the system defaults to the identity of a user needs to log on, the system starts the process also need to start with a user, the user can limit certain processes to specific resources competence

Linux have up to 60,000 or less users, each user has a the UserID, Linux according to distinguish user UID, the length of the UID 32, the user ID from zero, the user ID is divided into three Linux

  • 0: root user
  • 1 to 500: User
  • 500 or more: the average user

Linux live every file in every folder has a one owner and group, Linux users the following features:

  • Each user has a UserID, UID to distinguish users according to the operating system
  • Each user belonging to a primary group, belonging to one or more affiliated groups, the user has a maximum of 31 groups affiliated
  • Each group has a GroupID
  • Each process running, in order to restrict the identity of a user process access to a specific resource
  • Each user can have a designated login shell environment

id command and passwd command

Use the id command to view the currently logged on user information

Use the passwd command to change the current user's password (must be difficult to know the original password and password set)

id # to view the current logged-in user information 
passwd # modify the current logged-on user's password

useradd command (root privileges)

Commands: Create a User

Command parameters:

  • -b: Specifies the account's home directory
  • -d: Specifies the home directory account
  • -D: useradd display or modify the default configuration
  • -e: Specifies the account expiration
  • -f: Password inactivity period for new accounts
  • -g: group name or ID of the main Account
  • -G: Additional accounts list
  • -m: Create a user's home directory
  • -M: do not create the user's home directory
  • -N: do not create a group with the same name
  • -o: allow users to create duplicate UID
  • -p: encrypted user passwords
  • -r: Create a system user
  • -s: account to log on to the shell
  • -u: Account UID
  • -U: Create a user name and the same group

Create a user process:

  • Add user information in / etc / passwd file
  • If you create a password using the passwd, the password will be saved to / etc / shdawn in
  • Add the user's home directory / home / username 
  • Copy .bash beginning of the file / etc / skel in the / home / username home directory
  • Create a group with the same name as the user, the user's default group belonging to the same name as the user
  • Save the information to create a set of numbers to / etc / group profiles
useradd admin # Add a user 
passwd admin # modify the user's password
useradd -G admin, root a # to create a user and add affiliated group

Guess you like

Origin www.cnblogs.com/sunhouzi/p/12106842.html