Linux学习笔记四[用户和组的管理]

admin 发表于 Linux 分类,标签:
0

5.1 用户的管理

Linux下的三类用户
超级用户(root)具有操作系统的一切权限UID值均为0
普通用户具有操作系统有限的权限UID值500~6000
伪用户是为了方便系统管理,満足相应的系统进程文件属主的的要求,伪用户不能登录,UID值1~499

用户账户文件
/etc/passwd

[root@centmini ~]# less /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
wss:x:500:500::/home/wss:/bin/bash

用户名:密码:uid:gid:全名:主目录:shell环境

/etc/shadow
[root@centmini ~]# less /etc/shadow
root:$1$BgTs6rfS$r6Zgo3MjCjtLhQh7dO6ZF1:14512:0:99999:7:::
bin:*:14512:0:99999:7:::

用户名:密码:从Linux使用以来,口令被修改的天数:口令的最小修改间隔:口令失效的天数:口令失效后帐号的锁定天数:帐号到期日时间:保留位
命令1: useradd  新增用户  常用参数 –g 指定组别
命令2: passwd   为用户设置密码
命令3: userdel  删除用户  常用参数  -r 删除用户的所有信息
命令4: usermod  修改账户

[root@centmini /]# useradd test001
[root@centmini /]# passwd test001
Changing password for user test001.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@centmini /]# userdel test001
[root@centmini /]# ls /home
test001
Tips:创建用户时,不指定参数,系统会自动创建同名的组

5.2 组的管理

/etc/group

[root@centmini /]# more /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
组名:组口令:gid:组内用户列表

命令4:groupadd  创建一个组  常用参数 –g 指定gid
命令5:groupdel  删除一个组
命令6:groupmod  修改组属性  常用参数 –n 改名 –g 改gid
命令7:id        查看一个用户的UID和GID
命令8:finger    查看用户的相关信息
[root@centmini /]# groupadd xixi -g 555
[root@centmini /]# more /etc/group
root:x:0:root

xixi:x:555:
[root@centmini /]# groupmod xixi -n haha
[root@centmini /]# more /etc/group
root:x:0:root

haha:x:555:
[root@centmini /]# id root
uid=0(root)gid=0(root)groups=0(root),1(bin),2(daemon),3(sys),
4(adm),6(disk),10(wheel)
[root@centmini /]# finger root
Login: root                             Name: root
Directory: /root                        Shell: /bin/bash
On since Sat Sep 26 19:49 (EDT) on pts/0 from 192.168.128.2
No mail.
No Plan.

 

设置组的管理员  gpasswd –A USER GROUP
                Gpasswd  -d USER GROUP

.


发表我的评论

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word