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

本站现有博文337篇,共被浏览961429次

本站已经建立2673天!

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