<>Linux Account management learning

<> account management

brief introduction

Linux The system is a multi-user and multi task time-sharing operating system , Any user who wants to use system resources , You must first apply to the system administrator for an account , Then enter the system as this account .

On the one hand, the user's account can help the system administrator track the users using the system , And control their access to system resources ; On the other hand, it can also help users organize files , And provide security protection for users .

Each user account has a unique user name and password .

After the user enters the correct user name and password when logging in , You can enter the system and your own home directory .

Realize the management of user account , The work to be completed mainly includes the following aspects :

* Addition of user account , Deletion and modification .
* Management of user password .
* User group management .
User account management

The management of user account mainly involves the addition of user account , Modification and deletion .

Adding a user account is to create a new account in the system , Then assign a user number to the new account , User group , Home directory and login Shell Other resources .

Owner , Genus group

Add user

useradd - option user name

-m : Automatically create this user's home directory /home/tianqinglong

Understand the essence :Linux Everything in the document , Adding users here means writing user information to a file ! /etc/passwd

delete user

userdel -r tianqinglong When deleting a user, delete his directory page !

Modify user

usermod Corresponding modified content Which user to modify

usermod -d /home/233 tianqinglong

After modification, you can view the configuration file !

Switch users

1. The command to switch users is : su username [username It's your user name 】

2. Switch from normal user to root user , You can also use commands : sudo su

3. Input at terminal exit or logout Or use shortcuts ctrl+d, You can return to the original user , actually ctrl+d It is also implemented exit command

* extend (xshell) Change host name hostname New name Remember to restart
4. When switching users , If you want to use the working environment of the new user after switching users , Can be in su and username Add between -, for example :【su - root】

$ Represents an ordinary user

# Represents a superuser , that is root user

User's password setting problem !

We usually pass root When creating users ! To configure a password !

Linux The password entered will not be displayed ! Just input it normally , It's not a system problem !

In the company , You usually can't get the company server root jurisdiction , They are all assigned accounts !

If it's a super user :
passwd tianqinglong input 123456 Enter again 123456
Ordinary users
passwd Enter current password # The password cannot be too simple Enter new password
Lock account !

root, For example, Zhang San resigned ! Freeze this account , Once frozen , This person can't log in to the system !
passwd -l tianqinglong # After locking, this user cannot log in passwd -d tianqinglong # You can't log in without a password
You don't usually touch it root user !

Technology
©2019-2020 Toolsou All rights reserved,
C++ of string of compare usage Python Study notes ( one )evo Tool usage problems ——Degenerate covariance rank, Umeyama alignment is not possibleRISC-V_GD32VF103-TIMER0 timer interrupt java Array subscript variable _Java Basic grammar : array be based on stm32 Control four-wheel trolley motor drive ( one ) be based on redis Design of liking function Software engineering career planning mysql Query random data by conditions _MySQL Random query of several qualified records centos7 install RabbitMq