userdel
로컬 사용자 계정을 삭제하는 shadow-utils 관리 명령이다.
Installation
- Debian / Ubuntu:
sudo apt install passwd - RHEL / Fedora:
sudo dnf install shadow-utils - macOS와 Windows는 다른 계정 관리 체계를 사용한다.
userdel --help
Usage
userdel [OPTIONS] LOGIN-r, –remove: 홈 디렉터리와 mail spool도 삭제-f, –force: 로그인 중이거나 일부 오류가 있어도 삭제를 강제
Safe workflow
id alice pgrep -u alice sudo usermod --lock alice sudo userdel alice
userdel -r과 userdel -f는 파괴적이다. 홈 밖의 사용자 소유 파일, 실행 중인 프로세스, cron, service, backup 보존 정책을 먼저 확인한다. -r도 다른 filesystem에 있는 모든 소유 파일을 자동으로 제거하지 않는다.
Examples
sudo userdel alice # 검토와 백업을 마친 뒤에만 홈까지 제거 sudo userdel --remove alice
Help
See Also
History
- codex:: 2026-08-10 Migrated and expanded the page, retaining the recorded remove and force options with stronger safety guidance.