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

本站现有博文342篇,共被浏览1056857次

本站已经建立2730天!

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