關於linux的一些使用者群組管理(一)

2021-08-14 03:52:04 字數 3276 閱讀 5405

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的使用者 群組和許可權

linux的使用者 群組和許可權 核心 一切皆檔案 一切命令皆是為了操作檔案 一行代表乙個使用者的詳細資訊,以 作為分隔符,分成七段 如 root x 0 0 root root bin bash bin x 1 1 bin bin sbin nologin 七段 使用者名稱 密碼 以佔位符 x 代...

關於Linux使用者的一些介紹

基本知識 linux會用一些使用者識別符號來表示沒乙個使用者,包括使用者的id和使用者所屬於的組。重要的有兩個id 使用者id uid 使用者組id gid id與賬號的對應關係在 etc passwd中。新增使用者 useradd 例 新增使用者test,終端輸入useradd test後,hom...

關於MOS管的一些拙見

mos管在很多專案中都是一定會出現的,在不同場合,mos的作用也不同。本文意在記錄現階段對於mos管的認識與見解。mos管是一種利用電場效應來控制其電流大小的半導體器件。這種器件不僅兼有體積小 重量輕 耗電省 壽命長的特點,而且還具有輸入阻抗高 雜訊低 抗輻射能力強 製造工藝簡單等優點。mos管在大...