linux 用户添加配置

本文发布时间: 2019-Mar-22
添加用户命令 adduser ,往/etc/passwd 添加用户信息lemon : x : : : : /home/lemon : /bin/bash用户名 :密码(用x表示,具体密码在/etc/shadow中,只能由root查看修改): 用户id :用户组id ; 用户描述信息 :家目录:用户使用的shell环境/etc/shadow lemon : !$ $OCOlZeym$u CsvC Anqyv LWnY l : : : : : : :用户名 : md 加密后的密码(!表示此用户锁定) : 上次修改密码天shu(从 - - 起算): 最近两次密码修改间隔天书:: 密码间隔最大天数( 表无限期 ) : 密码将失效天数 : 几天未登录,帐号失效 : 帐号有效天数  修改用户信息 :useradd lemon -d 家目录 -s shell路径usermod -L/-U lemon 锁定/解锁usermod -f n(数值) lemon 几天未登录,帐号失效usermod -e - - lemon 帐号有效期时间usermod -c " this is my user " lemon 修改用户信息usermod -u lemon 修改用户id号usermod -g newgroup lemon 更改用户自身所属组, lemon原本组还存在,但已经没用户usermod-G newgroup lemon 将用户加到newgroup,将lemon再加到newgroup组中  /etc/group /etc/gshadow添加删除用户组使用 groupadd groupdel修改组信息使用 gpasswd gpasswd lemon 为lemon组添加密码gpasswd -A user lemon 设置user为lemon组管理员gpasswd -M user ,user ,user lemon 将user ,user ,user 多个成员添加到lemon组gpasswd -a user lemon 单个用户添加进组gpasswd -d user lemon 删除组用户gpasswd -r lemon 删除密码newgrp newgroup 进入newgroup组  //系统用户的一些参数[root@localhost etc]# cat login.defs # *REQUIRED* # Directory where mailboxes reside, _or_ name of file, relative to the # home directory. If you _do_ define both, MAIL_DIR takes precedence. # QMAIL_DIR is for Qmail # #QMAIL_DIR Maildir #为用户建立邮件MAIL_DIR /var/spool/mail #MAIL_FILE .mail  # Password aging controls:# # PASS_MAX_DAYS Maximum number of days a password may be used. # PASS_MIN_DAYS Minimum number of days allowed between password changes. # PASS_MIN_LEN Minimum acceptable password length. # PASS_WARN_AGE Number of days warning given before a password expires. # # 密码信息PASS_MAX_DAYS PASS_MIN_DAYS PASS_MIN_LEN PASS_WARN_AGE  # # Min/max values for automatic uid selection in useradd # UID_MIN UID_MAX  # # Min/max values for automatic gid selection in groupadd # GID_MIN GID_MAX  # # If defined, this command is run when removing a user. # It should remove any at/cron/print jobs etc. owned by # the user to be removed (passed as the first argument)。  # # 删除用户将用户相关所有信息一并删除,注释表否#USERDEL_CMD /usr/sbin/userdel_local  # # If useradd should create home directories for users by default # On RH systems, we do. This option is overridden with the -m flag on # useradd command line. # # 默认给新添用户创建家目录CREATE_HOME yes  # The permission mask is initialized to this value. If not specified,# the permission mask will be initialized to . UMASK  # This enables userdel to remove user groups if no members exist. # USERGROUPS_ENAB yes  # Use MD or DES to encrypt password? Red Hat use MD by default. MD _CRYPT_ENAB yes  添加用户默认参数设置文件 /etc/default/useradd [root@localhost default]# cat /etc/default/useradd # useradd defaults file GROUP= HOME=/home INACTIVE=- EXPIRE= SHELL=/bin/bash SKEL=/etc/skel //用户所需配置文件,当建立新用户时,从/etc/skel复制文件到家目录下CREATE_MAIL_SPOOL=yes // 添加邮件服务


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表