User management command summary and etc file

User command summary:

useradd Add user
userdel Execute this command to delete the configuration information of the user and related users
passwd Passwords can be set for users
chage  Password expiration date can be changed
usermod Modify user information, such as user group, home directory, etc.
id View user uid, gid and user group to which they belong

his

switch user
sudo Execute commands through another user, such as sudo ls /root, without the root password, you can execute the corresponding commands or directory permissions that only root can execute. This permission needs to be implemented through the visudo command or directly editing /etc/sudoers
visudo Edit commands to configure sudo permissions (syntax is automatically detected, which is more accurate than editing /etc/sudoers directly)

 

 

 

 

 

 

 

 

 

 

/etc/skel directory: directory to store new user configuration files

In the process of creating a user, the system will copy the files in the directory to the user's home directory

By default, all files in this directory are hidden files. By modifying, adding, and deleting files in this directory, a unified, standard, and initialized user environment can be provided for newly created users.

If these hidden files in the user's home directory are deleted, the following phenomena will occur:

To return to normal, you must copy the files in /etc/skel back, remember to change the owner to the user's username

 

/etc/login.defs directory:

  login.defs is a file for setting user account restrictions. Here we can configure the maximum expiration days of the password, the maximum length of the password and other content. The configuration in this file is invalid for the root user . If there are the same options in the /etc/shadow file, the settings in /etc/shadow shall prevail, that is to say, the configuration priority of /etc/shadow is higher than that of /etc/login.defs

 
#*REQUIRED*
#Directorywheremailboxesreside,_or_nameoffile,relativetothe
#homedirectory.Ifyou_do_defineboth,MAIL_DIRtakesprecedence.
#QMAIL_DIrisforQmail
#
#QMAIL_DIRMaildir
MAIL_DIR/var/spool/mailNote: When creating a user, create a user mail file in the directory /var/spool/mail ;
# MAIL_FILE.mail
#Passwordagingcontrols:
#
.
#PASS_MAX_DAYSMaximumnumberofdaysapasswordmaybeused .
#PASS_MIN_DAYSMinimumnumberofdaysallowedbetweenpasswordchanges . #PASS_MIN_LENMinimumacceptablepasswordlength .
#PASS_WARN_AGENumberofdayswarninggivenbeforeapasswordexpires
#
PASS_MAX_DAYS99999 Note: the user's password but a few of the most days;
PASS_MIN_DAYS0 Note: the minimum number of days between password changes;
PASS_MIN_LEN5 Note: the minimum password length;
PASS_WARN_AGE7 Note:
#
#Min/maxvaluesforautomaticgidselectioninuseradd
#
UID_MIN500 Note: The minimum UID is 500, that is to say, when adding a user, the UID starts from 500;
UID_MAX60000 Note: The maximum UID is 60000;
#
#Min/maxvaluesforautomaticgidselectioningroupadd
#
GID_MIN500 Note: GID is Starting at 500;
GID_MAX60000
#
#Ifdefined,thiscommandisrunwhenremovingauser.
#Itshouldremoveanyat/cron/
printjobsetc.ownedby #theusertoberemoved(passedasthefirstargument).
#
#USERDEL_CMD/usr/sbin/userdel_local
#
#Ifuseraddshouldcreatehomedirectoriesforusersbydefault
#OnRHsystems,wedo.ThisoptionisORedwiththe-
mflagon
#
CREATE_HOMEyes Note: Whether to create a user's home directory, it is required to create it;

 

/etc/default/useradd file: User rules file added for settings.

  1 # useradd defaults file

  2 GROUP=100 # User group ID

  3 HOME=/home #Create the user's home directory in /home.

  4 INACTIVE=-1 # Whether to enable account expiration suspension, -1 means not to enable.

  5 EXPIRE= #Account termination date, if not set, it will not be enabled.

  6 SHELL=/bin/bash #Type of SHELL used

  7 SKEL=/etc/skel #The default file storage location of the user's directory is added by default. That is, when a user adds a user with useradd, the files in the user's home directory are copied from this directory.

  8 CREATE_MAIL_SPOOL=yes #Whether to create user mail buffer, yes means create

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325276742&siteId=291194637