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

本站现有博文324篇,共被浏览819196

本站已经建立2522天!

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