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

本站现有博文319篇,共被浏览749643

本站已经建立2402天!

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