본문 바로가기
OS/Linux

계정관리(사용자 추가 옵션)(1)

by Yoon_estar 2024. 2. 13.
728x90

사용자 추가 옵션

[root@estar987_LocalPC home]# useradd
Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]

Options:
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
  -c, --comment COMMENT         GECOS field of the new account
  **-d, --home-dir HOME_DIR       home directory of the new account**
  **-D, --defaults                print or change default useradd configuration**
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
  -f, --inactive INACTIVE       password inactivity period of the new account
  **-g, --gid GROUP               name or ID of the primary group of the new**
                                account
  **-G, --groups GROUPS           list of supplementary groups of the new**
                                **account**
  -h, --help                    display this help message and exit
  -k, --skel SKEL_DIR           use this alternative skeleton directory
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -l, --no-log-init             do not add the user to the lastlog and
                                faillog databases
  **-m, --create-home             create the user's home directory**
  -M, --no-create-home          do not create the user's home directory
  -N, --no-user-group           do not create a group with the same name as
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  **-p, --password PASSWORD       encrypted password of the new account**
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  **-U, --user-group              create a group with the same name as the user**
  -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping

사용자 생성 정보 기본 확인

[root@estar987_LocalPC home]# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

[root@estar987_LocalPC home]# cat /etc/default/useradd
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

홈 디렉터리 지정하기

oot@estar987_LocalPC home]# useradd -m -d /root/poiuy poiuy
[root@estar987_LocalPC home]#
[root@estar987_LocalPC home]# cd /root/
[root@estar987_LocalPC ~]# ll
합계 655364
drwxr-xr-x   2 root  root       4096  1월 29 11:01 Download
drwx------   3 poiuy poiuy      4096  2월 13 15:25 poiuy
[root@estar987_LocalPC ~]#

UID 지정하기

[root@estar987_LocalPC ~]# useradd -u 1010 testuser2
[root@estar987_LocalPC ~]# 
[root@estar987_LocalPC ~]# id -u testuser2
1010

'OS > Linux' 카테고리의 다른 글

grep  (0) 2024.02.15
SU vs SU -  (0) 2024.02.15
계정 관리하기 (3)  (0) 2024.02.13
계정 관리하기 (2)  (0) 2024.02.13
계정 관리하기(1)  (0) 2024.02.13