리눅스 사용자 계정 생성 팁

|
리눅스에서 사용자 계정을 생성하면 자동으로 홈디렉토리를 만들고 권한도 주게 되어 있다.

근데 이 기본 설정이 마음에 들지 않는다면 바꿔보자.

손봐야 할 파일은 아래와 같다.

/etc/login.defs

내용은 아래와 같다.

# *REQUIRED*
#   Directory where mailboxes reside, _or_ name of file, relative to the
#   home directory.  If you _do_ define both, MAIL_DIR takes precedence.
#   QMAIL_DIR is for Qmail
#
#QMAIL_DIR      Maildir
MAIL_DIR        /var/spool/mail
#MAIL_FILE      .mail

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   99999
PASS_MIN_DAYS   0
PASS_MIN_LEN    5
PASS_WARN_AGE   7

#
# Min/max values for automatic uid selection in useradd
#
UID_MIN                   500
UID_MAX                 60000

#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN                   500
GID_MAX                 60000

#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD    /usr/sbin/userdel_local

#
# If useradd should create home directories for users by default
# On RH systems, we do. This option is overridden with the -m flag on
# useradd command line.
#
CREATE_HOME     yes

# The permission mask is initialized to this value. If not specified,
# the permission mask will be initialized to 022.
UMASK           077 <- 이것은 777 - 077 즉 만들어지는 사용자 계정의 권한이 700 으로 만들어진다.
                                    076 으로 변경하면 777 - 076 = 701로 된다. 웹계정을 많이 만든다면 이게 좋다.

# This enables userdel to remove user groups if no members exist.
#
USERGROUPS_ENAB yes

대충 읽어보면 짐작이 가리라 본다.

홈디렉토리, 쉘, SKEL 등을 변경하고 싶다면 아래 파일을 만져보자.

/etc/default/useradd

내용은 아래와 같다.

# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

대충 읽어보면 짐작이 가리라 본다. ^______________^
 

And