Linux使用者和組管理命令 使用者刪除userdel

2022-06-06 13:39:11 字數 1243 閱讀 8982

userdel 可刪除linux 使用者

userdel [option]... login

-f, --force 強制

-r, --remove 刪除使用者家目錄和郵箱

使用-r引數會刪除使用者的所有資料,慎重!

[00:47:17 root@c8[ ~]#ll /home ##檢視家目錄,分別有兩個新建使用者的家目錄

total 0

drwxr-xr-x. 2 root root 79 jul 13 00:16 test211

drwx------. 2 test985 test985 95 jul 13 00:31 test985

[00:49:09 root@c8[ ~]#ll /var/spool/mail/ ##檢視郵箱目錄,費別有連個新建使用者的郵箱目錄

total 0

-rw-rw----. 1 test211 mail 0 jul 12 23:37 test211

-rw-rw----. 1 test985 mail 0 jul 13 00:31 test985

[00:49:30 root@c8[ ~]#userdel -r test*

userdel: user 'test.txt' does not exist

[00:50:00 root@c8[ ~]#userdel -r test211 ##test211在另乙個shell登入,不能刪除

userdel: user test211 is currently used by process 2488

[00:50:12 root@c8[ ~]#userdel -r test985 ##刪除985

[00:50:31 root@c8[ ~]#ll /home

total 0

drwxr-xr-x. 2 root root 79 jul 13 00:16 test211

[00:50:39 root@c8[ ~]#ll /var/spool/mail/

total 0

-rw-rw----. 1 test211 mail 0 jul 12 23:37 test211

id 命令可以檢視使用者的uid,gid等資訊

id [option]... [user]

-u: 顯示uid

-g: 顯示gid

-g: 顯示使用者所屬的組的id

-n: 顯示名稱,需配合ugg使用

Linux命令 使用者和使用者組管理

4.1 普通使用者的管理 etc shadow檔案 儲存使用者密碼。passwd檔案可被普通使用者訪問,而shadow檔案只能被根使用者訪問。檔案格式為 username encrypted password number of days minimum password life maximum ...

linux使用者和組管理命令

回顧 bash globing,io重定向 glob 使用者管理基礎概念 使用者類別 管理員 普通使用者 系統使用者和登陸使用者 組類別 管理員組 普通使用者組 基本組和附加組 私有組 公共組 資料庫檔案 etc passwd ect shadpw etc group 密碼儲存格式 單向加密,並借助...

linux使用者和組管理命令

運維必須掌握的27道linux面試題 11.請簡單說出使用者管理的相關命令及用途 組管理命令 groupadd 新增組 groupdel 刪除使用者組 groupmod 修改使用者組 groups 顯示當前使用者所屬的使用者組 grpck 檢查使用者組及密碼檔案的完整性 etc group以及 et...