2020. 6. 10. 13:28ㆍOS/Linux
[User and Group 관리]
1) user and group configuration file
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
[user 생성/수정/삭제]
a. useradd
useradd --help
Usage: useradd [options] LOGIN
# useradd test
# cat /etc/default/useradd
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
b. usermod
usermod -G projectB user1
usermod -L username == passwd -l username
usermod -U username == pwddwd -u username
c. userdel
userdel username
userdel -r username - home dir, mail spool 삭제
[Group 관리]
a. groupadd
# groupadd -g 1000 project
b. groupmod
# groupmod -n projectA project
c. groupdel
# groupdel projectA
[Password 관리]
- /etc/shadow
- chage
[login script(bash)]
a. /etc/profile - PATH, USER, MAIL, ....
/etc/profile.d/*sh - app이 필요로하는 환경변수 설정
b. ~/.bash_profile - 환경변수
c. ~/.bashrc - set -o vi, alias
/etc/bashrc - umask, PATH
[계정 생성]
1. 그룹 생성
groupadd -g [그룹 번호] [그룹명]
# groupadd -g 1000 testuser
2. 유저생성
usradd -G [그룹명] -d [폴더 위치] -s [셸 지정] -c [주석] [계정명]
# useradd -G manager -d / -s /bin/bash -c "테스트 계정 생성" manager
[여러 그룹에 포함된 계정 생성]
useradd -u [계정 번호] -g [주그룹명] -G [부그룹명] -d [홈디렉토리] -s [셸 지정] -c [주석] [계정명]
# useradd -u 3011 -g testuser -G manager -d /root/test -s /bin/ksh -c "테스트 계정 생성 2" test2
[계정 변경]
- 홈디렉토리 변경
usermod -d [변경 디렉토리 위치] [계정]
# usermod -d /test/test2 test2
- 주그룹 변경
usermod -g [그룹명] [계정]
# usermod -g testuser test2
- 부그룹 변경
usermod -G [그룹명1,그룹명2] [계정]
# usermod -G testuser2,manager test2
※ 부그룹의 경우 기존 및 신규 추가시 모든 부그룹을 다시 명시해주어야 된다.
- 계정명 변경
usermod -l [변경하고자 하는 계정명] [계정]
# usermod -l test2 mgr1
- 쉘스크립트를 변경
usermod -s [쉘스크립트명] [계정]
# usermod -s /bin/bash mgr1
[계정 접속 실패 확인 및 잠김 상태 확인]
pam_tally2 -u [계정명]
# pam_tally2 -u mgr1
[잠긴 계정 unlock]
pam_tally2 -u [계정명] -r
# pam_tally2 -u mgr1 -r
[계정 정보 확인]
chage -l [계정명]
# chage -l mgr1
[계정 패스워드 기간 변경]
chage -M[기간] [계정명]
# chage -M90 mgr1
[사용자 로그인시 패스워드 재 설정]
passwd -e [계정명]
# passwd -e mgr1
[계정삭제]
userdel [계정명]
# userdel mgr1
[계정삭제 및 계정 디렉토리 삭제]
userdel -r [계정명]
userdel -r mgr1
'OS > Linux' 카테고리의 다른 글
[장애대처]gnome-session (0) | 2020.06.10 |
---|---|
[Command]yum (0) | 2020.06.10 |
[Command]용량 관련 (0) | 2020.06.10 |
[Command]Filesystem 생성 (0) | 2020.06.09 |
[Config]Cron (0) | 2020.06.09 |