Linux userdel 命令解析示例

2021-08-04 08:24:17 字數 1352 閱讀 5219

執行許可權:root

功能說明:刪除使用者帳號。

語  法:userdel [-r][使用者帳號]

補充說明:userdel可刪除使用者帳號與相關的檔案。若不加引數,則僅刪除使用者帳號,而不刪除相關檔案。

常用引數:

-r ,表示在刪除使用者的同時,一併把使用者的家目錄及本地郵件儲存的目錄或檔案也一同刪除

linux userdel 命令用法

userdel student 刪除使用者student,但不刪除其家目錄及檔案;

userdel -r student 刪除使用者student,其家目錄及檔案一併刪除;

linux userdel 命令使用中的一些常見問題提示許可權不夠

原因 非root使用者沒有許可權刪除使用者

解決方法 切換到root使用者執行刪除使用者操作

su root

userdel -r test

提示使用者已登陸

原因 使用者未登出或改使用者有程序仍在執行

使用who或者w命令檢視當前登入的使用者

這裡顯示當前linux伺服器只有我乙個使用者(我此時使用的是root使用者),說明已經關閉了test使用者的連線

在root使用者下,輸入指令

可以發現,使用者test有兩個程序在執行。

執行kill -9 1780

kill -9 1802

強制關閉這兩個程序,然後再執行刪除使用者的指令 userdel -r test 。

使用者test終於被shutdown了。

再檢視使用者

cat /etc/passwd |cut -f 1 -d :

已經沒有test使用者了,問題完美解決。

Linux IP 命令略解

help 為該命令的幫助資訊。例項ip link show 顯示網路介面資訊 ip link set eth0 up 開啟網絡卡 ip link set eth0 down 關閉網絡卡 ip link set eth0 promisc on 開啟網絡卡的混合模式 ip link set eth0 p...

Linux Jobs等前後臺執行命令解

shell支援作用控制,有以下命令 1.command 讓程序在後台執行 2.jobs 檢視後台執行的程序 3.fg n 讓後台執行的程序n到前台來 4.bg n 讓程序n到後台去 ps n 為jobs檢視到的程序編號.b.下列 http blog.chinaunix.net u 1604 show...

centos7沒有ifconfig命令解決辦法

轉至 ifconfig是檢視ip資訊,linux最小化安裝是沒有ifconfig,本經驗演示如何安裝ifconfig 1.輸入ifconfig 提示不存在 2.首先確認下是否是環境變數沒有ifconfig 引起。3.以上確定了系統是沒有安裝ifconfig,下面我們來安裝 yum install i...