关于linux的一些用户群组管理(一)

1、------------------------------------
普通的账号管理:
账号名称    账号全名   支援次要群组   是否可登入主机  密码
hxs         hanxiaoshun xygroup	        可以	      hxs123456
zl	    zhaolong    xygroup  	可以	      zl123456

wz thirdUser 无额外支持 不可以 wz123456

[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# groups
root
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# groupadd xygroup
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -G xygroup -c "hanxiaoshun" hxs
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -G xygroup -c "zhaolong" zl
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -c "wuzheng" -s /sbin/nologin wz
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# 
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# 
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "hxs123456"|passwd --stdin hxs
Changing password for user hxs.
passwd: all authentication tokens updated successfully.
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "zl123456"|passwd --stdin zl
Changing password for user zl.
passwd: all authentication tokens updated successfully.
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "wz123456"|passwd --stdin wz
Changing password for user wz.
passwd: all authentication tokens updated successfully.
2、-----------------------------------
多人在同一文件夹下进行项目开发,但这三个用户还是拥有自己的家目录与基本的私有群组,假设这个项目计划在/srv/projecta
账号名称    账号全名        支援次要群组   是否可登入主机  密码
hxsa         hanxiaoshuna       projecta	可以	      hxs123456a
zla	     zhaolonga          projecta  	可以	      zl123456a
wza	     wuzhenga	        projecta 	可以	      wz123456a

[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# su hxs
[hxs@iZ2zeg4tkk4ub8wept0hrjZ root]$ groups
hxs xygroup
[hxs@iZ2zeg4tkk4ub8wept0hrjZ root]$ exit
exit
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# groupadd projecta
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -G projecta -c "hanxiaoshuna" hxsa
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -G projecta -c "zhaolonga" zla
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# useradd -G projecta -c "wuzhenga" wza
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "hxs123456a"|passwd --stdin hxsa
Changing password for user hxsa.
passwd: all authentication tokens updated successfully.
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "zl123456a"|passwd --stdin zla
Changing password for user zla.
passwd: all authentication tokens updated successfully.
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# echo "wz123456a"|passwd --stdin wza
Changing password for user wza.
passwd: all authentication tokens updated successfully.
[root@iZ2zeg4tkk4ub8wept0hrjZ ~]# cd /srv/
[root@iZ2zeg4tkk4ub8wept0hrjZ srv]# ll
total 0
[root@iZ2zeg4tkk4ub8wept0hrjZ srv]# mkdir /srv/projecta
[root@iZ2zeg4tkk4ub8wept0hrjZ srv]# chgrp projecta /srv/projecta/
[root@iZ2zeg4tkk4ub8wept0hrjZ srv]# chmod 2770 /srv/projecta/
[root@iZ2zeg4tkk4ub8wept0hrjZ srv]# ll -d /srv/projecta/
drwxrws--- 2 root projecta 4096 Dec 28 11:47 /srv/projecta/

问题:


鸣谢:鸟哥的Linux私房菜-基础学习篇%28第四版%29高清完整书签PDF版(Linuxidc.com).pdf

你可能感兴趣的:(linux进阶学习)