EADST

Delete a User in Linux

Deleting a user in Linux is a common administrative task, especially when cleaning up old or inactive accounts. In this short guide, we'll walk you through the steps to safely remove a user from your system.

1. Check Existing Users

Before deleting a user, it's a good idea to confirm the user exists. You can check the list of users in the /etc/passwd file or run:

cat /etc/passwd
This command lists all system users.

2. Deleting a User

To delete a user, Linux provides the userdel command. If you simply want to remove the user without touching their home directory or files, run:

sudo userdel username
Replace username with the account you want to delete.

3. Delete the User and Home Directory

If you also want to remove the user’s home directory and mail spool, use the -r option:

sudo userdel -r username

4. Handling Active User Processes

If the user is currently logged in or running processes, you might see an error like:

userdel: user username is currently used by process 
To resolve this, terminate their processes with:
sudo killall -u username
Then, proceed with deleting the user.

Conclusion

Managing users in Linux is straightforward with the userdel command. Just be cautious, especially when using the -r option, as it permanently removes the user’s files.

This guide should help you effectively manage and clean up user accounts on your Linux system!

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Quantization ONNX PDF Shortcut CLAP TTS Card RAR DeepStream EXCEL Transformers Algorithm Excel Freesound XGBoost Docker OpenAI 音频 Ptyhon Hungarian OCR Color Cloudreve FlashAttention 飞书 ResNet-50 Knowledge uwsgi tar 公式 icon ChatGPT 版权 搞笑 Random GGML CTC HuggingFace Pytorch InvalidArgumentError MD5 Attention LaTeX Disk Statistics torchinfo Qwen Jev Gemma RL NLP JSON 阿里云 Interview UI GIT AI 图形思考法 Vmess Base64 OpenCV Safetensors Streamlit Vim 图标 Tracking Math Llama PyCharm Google Jetson Anaconda Website Qwen2 Qwen2.5 Sklearn IndexTTS2 Datetime Jupyter PyTorch Bitcoin Review Zip News Land Markdown COCO Pillow Bin v0.dev Dataset Permission 递归学习法 Logo Magnet 继承 CEIR Translation RGB CAM API Python FP8 Numpy Claude SVR Rebuttal 强化学习 Domain QWEN SAM Bipartite printf 顶会 tqdm v2ray Food VGG-16 PIP 云服务器 C++ Paper Clash Template Miniforge BeautifulSoup Use 第一性原理 BTC Django Pandas Bert WAN Proxy git-lfs Harness Data Ubuntu 净利润 Diagram Tiktoken Image2Text TSV 关于博主 uWSGI Conda 签证 FP32 Pickle LLM 域名 hf 报税 Password API网关 CV 论文 XML 证件照 Hotel PDB Quantize Plotly Search GPTQ Animate DeepSeek FP16 VPN git SQLite Distillation Input Plate logger 财报 多线程 Github HaggingFace FastAPI Mixtral diffusers Augmentation 腾讯云 Nginx TensorRT ms-swift Firewall Video NameSilo Paddle FP64 Heatmap SPIE Michelin CUDA 多进程 LoRA mmap ModelScope CSV CC transformers scipy Linux TensorFlow Agent 算法题 LLAMA Hilton Web NLTK GPT4 SQL YOLO LeetCode Windows llama.cpp Baidu GoogLeNet VSCode Breakpoint Crawler Git 论文速读 WebCrawler BF16 UNIX Tensor
站点统计

本站现有博文338篇,共被浏览977942次

本站已经建立2690天!

热门文章
文章归档
回到顶部