IT정보공유

[LINUX] CentOS 사용자 정보 수정 - 홈디렉토리 변경 및 로그인 제한 등

알지오™ 2020. 1. 16.

리눅스 사용자 정보 변경 명령어를 알아보도록 하겠습니다.

(유닉스도 명령어와 옵션은 동일합니다.)

 

usermod 명령어

 

usermod 명령어는 사용자에게 지정된 홈디렉토리를 바꾸거나 그룹을 변경할 수 있고
사용자 계정을 잠그거나 기본쉘을 변경할 수 있는 명령어입니다.

 

usermod 명령어 사용법 : usermod [options] LOGIN

 

Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                him/her from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

 

다양한 옵션이 존재하는데 이중에서 비교적 자주 사용하는 옵션을 살펴보도록 하겠습니다.

 

usermod option

 

-c : 사용자 설명 변경
-p 패스워드 : 사용자 패스워드 변경
-d 홈디렉토리 : 사용자 홈디렉토리 변경
-G 그룹 : 사용자 그룹 변경
-s shell : 사용자 로그인 쉘 변경
-L : 사용자 락(로그인 제한)
-U : 사용자 언락(로그인 제한 해제)

 

댓글

💲 추천 글