⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux 用户(user)和用户组(group)管理概述 linuxsir_org.htm

📁 linuxSir 网站的精华文章
💻 HTM
📖 第 1 页 / 共 2 页
字号:
      size=2><B><BR>2)管理用户组(group)的工具或命令;<BR></B></FONT><BR>
      <DIV class=codeblock><CODE>groupadd 注:添加用户组;<BR>groupdel 
      注:删除用户组;<BR>groupmod 注:修改用户组信息<BR>groups 注:显示用户所属的用户组<BR>grpck<BR>grpconv 
      注:通过/etc/group和/etc/gshadow 的文件内容来同步或创建/etc/gshadow ,如果/etc/gshadow 
      不存在则创建;<BR>grpunconv 注:通过/etc/group 和/etc/gshadow 文件内容来同步或创建/etc/group 
      ,然后删除gshadow文件;</CODE></DIV>
      <P></P>
      <P><FONT size=3><B><BR>3、/etc/skel 
      目录;<BR></B></FONT><BR>/etc/skel目录一般是存放用户启动文件的目录,这个目录是由root权限控制,当我们添加用户时,这个目录下的文件自动复制到新添加的用户的家目录下;/etc/skel 
      目录下的文件都是隐藏文件,也就是类似.file格式的;我们可通过修改、添加、删除/etc/skel目录下的文件,来为用户提供一个统一、标准的、默认的用户环境;</P>
      <P>
      <DIV class=codeblock><CODE>[root@localhost beinan]# ls -la 
      /etc/skel/<BR>总用量 92<BR>drwxr-xr-x 3 root root 4096 8月 11 23:32 
      .<BR>drwxr-xr-x 115 root root 12288 10月 14 13:44 ..<BR>-rw-r--r-- 1 root 
      root 24 5月 11 00:15 .bash_logout<BR>-rw-r--r-- 1 root root 191 5月 11 00:15 
      .bash_profile<BR>-rw-r--r-- 1 root root 124 5月 11 00:15 
      .bashrc<BR>-rw-r--r-- 1 root root 5619 2005-03-08 .canna<BR>-rw-r--r-- 1 
      root root 438 5月 18 15:23 .emacs<BR>-rw-r--r-- 1 root root 120 5月 23 05:18 
      .gtkrc<BR>drwxr-xr-x 3 root root 4096 8月 11 23:16 .kde<BR>-rw-r--r-- 1 
      root root 658 2005-01-17 .zshrc</CODE></DIV>
      <P></P>
      <P>/etc/skel 目录下的文件,一般是我们用useradd 和adduser 
      命令添加用户(user)时,系统自动复制到新添加用户(user)的家目录下;如果我们通过修改 /etc/passwd 
      来添加用户时,我们可以自己创建用户的家目录,然后把/etc/skel 下的文件复制到用户的家目录下,然后要用chown 
      来改变新用户家目录的属主;<BR><FONT size=3><B><BR>4、/etc/login.defs 
      配置文件;<BR></B></FONT><BR>/etc/login.defs 
      文件是当创建用户时的一些规划,比如创建用户时,是否需要家目录,UID和GID的范围;用户的期限等等,这个文件是可以通过root来定义的;</P>
      <P>比如Fedora 的 /etc/logins.defs 文件内容;</P>
      <P>
      <DIV class=codeblock><CODE># *REQUIRED*<BR># Directory where mailboxes 
      reside, _or_ name of file, relative to the<BR># home directory. If you 
      _do_ define both, MAIL_DIR takes precedence.<BR># QMAIL_DIR is for 
      Qmail<BR>#<BR>#QMAIL_DIR Maildir<BR>MAIL_DIR /var/spool/mail 
      注:创建用户时,要在目录/var/spool/mail中创建一个用户mail文件;<BR>#MAIL_FILE .mail<BR># 
      Password aging controls:<BR>#<BR># PASS_MAX_DAYS Maximum number of days a 
      password may be used.<BR># PASS_MIN_DAYS Minimum number of days allowed 
      between password changes.<BR># PASS_MIN_LEN Minimum acceptable password 
      length.<BR># PASS_WARN_AGE Number of days warning given before a password 
      expires.<BR>#<BR>PASS_MAX_DAYS 99999 注:用户的密码不过期最多的天数;<BR>PASS_MIN_DAYS 0 
      注:密码修改之间最小的天数;<BR>PASS_MIN_LEN 5 注:密码最小长度;<BR>PASS_WARN_AGE 7 注:<BR>#<BR># 
      Min/max values for automatic uid selection in useradd<BR>#<BR>UID_MIN 500 
      注:最小UID为500 ,也就是说添加用户时,UID 是从500开始的;<BR>UID_MAX 60000 
      注:最大UID为60000;<BR>#<BR># Min/max values for automatic gid selection in 
      groupadd<BR>#<BR>GID_MIN 500 注:GID 是从500开始;<BR>GID_MAX 60000<BR>#<BR># If 
      defined, this command is run when removing a user.<BR># It should remove 
      any at/cron/print jobs etc. owned by<BR># the user to be removed (passed 
      as the first argument).<BR>#<BR>#USERDEL_CMD 
      /usr/sbin/userdel_local<BR>#<BR># If useradd should create home 
      directories for users by default<BR># On RH systems, we do. This option is 
      ORed with the -m flag on<BR># useradd command line.<BR>#<BR>CREATE_HOME 
      yes 注:是否创用户家目录,要求创建;</CODE></DIV>
      <P></P>
      <P><FONT size=3><B><BR>5、/etc/default/useradd 文件;<BR></B></FONT></P>
      <P>通过useradd 添加用户时的规则文件;<BR>
      <DIV class=codeblock><CODE>&nbsp;# useradd defaults 
      file<BR>GROUP=100<BR>HOME=/home 注:把用户的家目录建在/home中;<BR>INACTIVE=-1 
      注:是否启用帐号过期停权,-1表示不启用;<BR>EXPIRE= 注:帐号终止日期,不设置表示不启用;<BR>SHELL=/bin/bash 
      注:所用SHELL的类型;<BR>SKEL=/etc/skel 注: 
      默认添加用户的目录默认文件存放位置;也就是说,当我们用adduser添加用户时,用户家目录下的文件,都是从这个目录中复制过去的;</CODE></DIV>
      <P></P>
      <P><FONT size=4><B><BR>后记:<BR></B></FONT></P>
      <P>关于用户(user)和用户组(group)管理内容大约就是这么多;只要把上面所说的内容了解和掌握,用户(user)和用户组(group)管理就差不多了;由于用户(user)和用户组(group)是和文件及目录权限联系在一起的,所以文件及目录权限的操作也会独立成文来给大家介绍;</P>
      <P>本文只是让新手弟兄明白用户(user)和用户组(group)一些原理,所以我在写此文的时候,大多是解说内容,我的意思是通过解说和索引一些命令,让新手弟兄明白一点理论是比较重要的,技术操作无非是命令的用法;</P>
      <P>本文内容会不断的更新和变动,一些命令需要独立成文加以解说,我会在最近的几天内完成;</P>
      <P><FONT size=4><B><BR>参考文档:<BR></B></FONT></P>
      <P>Linux 相关的man 和相关的help ;</P>
      <P><FONT size=4><B><BR>致谢:<BR></B></FONT></P>
      <P>对于本文,pandonny 兄也有贡献,谢谢;</P>
      <P><FONT size=4><B><BR>相关文档:<BR></B></FONT></P>
      <P><A href="http://www.linuxsir.org/main/?q=node/91">《Linux 
      用户(user)和用户组(group)管理概述》</A><BR><A 
      href="http://www.linuxsir.org/main/?q=node/98">《用户(user)和用户组(group)配置文件详解》</A><BR><A 
      href="http://www.linuxsir.org/main/?q=node/105">《Linux 
      用户(User)查询篇》</A><BR><A 
      href="http://www.linuxsir.org/main/?q=node/106">《Linux 用户管理工具介绍》</A><BR><A 
      href="http://www.linuxsir.org/main/?q=node/104">《Linux 
      系统中的超级权限的控制》</A><BR><A 
      href="http://www.linuxsir.org/main/?q=node/109">《在Linux系统中,批量添加用户的操作流程》</A></P></DIV>
      <DIV class=links>By beinan at 2005/10/14 - 15:39 | <A 
      href="http://www.linuxsir.org/main/?q=taxonomy/term/1">Linux</A> | <A 
      href="http://www.linuxsir.org/main/?q=taxonomy/term/25">基础知识</A> | <A 
      title=共享你有关本文的思想和意见。 
      href="http://www.linuxsir.org/main/?q=comment/reply/91#comment">参与评论</A> | 
      6468 阅读</DIV></DIV><A id=comment></A>
      <FORM action=?q=comment method=post>
      <DIV><INPUT type=hidden value=91 name=edit[nid]> <A id=comment-107></A>
      <DIV class=comment>
      <H3 class=title><A class=active 
      href="http://www.linuxsir.org/main/?q=node/91#comment-107">good</A></H3>
      <DIV class=content>
      <P>very very good</P></DIV>
      <DIV class=links>By Anonymous at 周一, 2005/12/05 - 11:18 | <A 
      href="http://www.linuxsir.org/main/?q=comment/reply/91/107">回复</A></DIV></DIV><A 
      id=comment-9></A>
      <DIV class=comment>
      <H3 class=title><A class=active 
      href="http://www.linuxsir.org/main/?q=node/91#comment-9">好!对我们新手有很大帮助啊!</A></H3>
      <DIV class=content>
      <P>对我们新手有很大帮助啊!<BR>正好我们linux的选修课就在教这个user/group,有些命令只是半懂,又懒得问老师,google起来也很费劲,这个文章把这方面的内容全给囊括了!haha~收藏</P></DIV>
      <DIV class=links>By Anonymous (没有被验证) at 周二, 2005/10/18 - 01:23 | <A 
      href="http://www.linuxsir.org/main/?q=comment/reply/91/9">回复</A></DIV></DIV></DIV></FORM><!-- end content -->
      <DIV id=footer>
      <CENTER><A href="http://www.linuxsir.org/"><IMG 
      src="Linux 用户(user)和用户组(group)管理概述  LinuxSir_Org.files/logo.jpg"></A> 
      <BR><A href="http://www.miibeian.gov.cn/"><FONT color=blue 
      size=3><B>闽ICP备06025536号</B></FONT></A><BR>
      <SCRIPT language=JavaScript 
      src="Linux 用户(user)和用户组(group)管理概述  LinuxSir_Org.files/cyberpolice.htm"></SCRIPT>
      <BR><A href="http://www.linuxsir.org/main/?q=node/78"><FONT color=blue 
      size=3><B>© 2002-2006 LinuxSir.Org</B></FONT></A><BR></CENTER></DIV></TD>
    <TD id=sidebar-right>
      <DIV class="block block-block" id=block-block-2>
      <H2 class=title>基础知识</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/23">安装配置</A> 
        <LI><A 
        href="http://www.linuxsir.org/main/?q=taxonomy/term/1/25/">基础入门</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/22/">硬件解决</A> 

        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/21">软件管理</A> 
        <LI><A 
        href="http://www.linuxsir.org/main/?q=taxonomy/term/35/48/">重要资源</A> 
        </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-4>
      <H2 class=title>软件应用</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/30">网络工具</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/32">图形图像</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/31">音乐视频</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/49">字体中文</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/33">软件其它</A> 
        </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-5>
      <H2 class=title>网络服务器</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/27">文件服务器<A> 
        <LI><A 
        href="http://www.linuxsir.org/main/?q=taxonomy/term/28">Web服务器</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/29">邮件服务器</A> 

        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/37">数据库应用</A> 

        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/50">服务器其它</A> 
        </LI></UL></DIV></DIV>
      <DIV class="block block-comment" id=block-comment-0>
      <H2 class=title>最新评论</H2>
      <DIV class=content>
      <DIV class=item-list>
      <UL>
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/222#comment-624">错了</A><BR>2 
        min 29 sec 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/222#comment-623">q</A><BR>22 
        min 6 sec 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/222#comment-622">有些道理</A><BR>43 
        min 35 sec 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/219#comment-621">"内置的摄像头也能用这个吗?"</A><BR>13 
        hours 48 min 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/80#comment-620">终于知道了...</A><BR>23 
        hours 3 min 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/106#comment-619">okok</A><BR>2 
        days 14 hours 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/93#comment-618">那要除去阴影呢?</A><BR>3 
        days 19 hours 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/227#comment-617">不错的机会</A><BR>4 
        days 6 hours 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/221#comment-616">配置可执行程序的路径</A><BR>4 
        days 12 hours 前
        <LI><A 
        href="http://www.linuxsir.org/main/?q=node/222#comment-615">修改hostname出现的问题</A><BR>5 
        days 2 hours 
前</LI></UL></DIV></DIV></DIV></TD></TR></TBODY></TABLE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -