useradd
낮은 수준에서 로컬 사용자 계정을 생성하는 shadow-utils 관리 명령이다.
Installation
- Debian / Ubuntu:
sudo apt install passwd - RHEL / Fedora:
sudo dnf install shadow-utils - macOS와 Windows는 다른 계정 관리 체계를 사용하며 공식 동일 명령이 없다.
useradd --help
Usage
useradd [OPTIONS] LOGINuseradd -D [OPTIONS]: 기본값 확인 또는 변경-d, –home-dir HOME_DIR: 홈 디렉터리 지정-m, –create-home: 홈 생성-M, –no-create-home: 홈을 생성하지 않음-g, –gid GROUP: 기본 그룹 지정-G, –groups GROUPS: 보조 그룹 목록 지정-N, –no-user-group: 같은 이름의 그룹을 만들지 않음-r, –system: 시스템 계정 생성-u, –uid UID: UID 지정-c, –comment COMMENT: GECOS 설명 지정-e, –expiredate YYYY-MM-DD: 계정 만료일 지정-f, –inactive DAYS: password 만료 후 비활성 기간-s, –shell SHELL: 로그인 셸 지정./sbin/nologin은 대화형 로그인을 막는 데 사용-p, –password HASH: 평문이 아닌 이미 암호화된 hash를 받는다.
Examples
sudo useradd -m -s /bin/bash alice sudo passwd alice sudo useradd -r -M -s /usr/sbin/nologin appsvc useradd -D
-p에 평문 password를 전달하지 않는다. shell history와 process list에 노출될 수 있으므로 계정 생성 후 passwd LOGIN으로 설정한다.
Configuration
/etc/default/useradd: useradd 기본값/etc/login.defs: UID 범위, password aging 등 shadow-utils 정책/etc/skel/: 새 홈에 복사할 skeleton 파일
Help
See Also
History
- codex:: 2026-08-10 Migrated and expanded the page while preserving all recorded creation, group, expiry, shell, UID, and password options.