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

本站现有博文321篇,共被浏览768909

本站已经建立2454天!

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