본문 바로가기

Linux/2) 리눅스 서버 관리자 과정

10_01-08 User & Group Administration - 홈계정 생성 시 참조되는 디렉토리 (/etc/skel) 및 파일

홈계정 생성 시 참조되는 디렉토리 (/etc/skel) 및 파일

: 사용자 계정이 생성될 때 /etc/skel (skelton) 디레토리 안에 파일들이 사용자 홈디렉토리로 복사되고, 사용자 것으로 소유자/그룹이 변경됨

 

# useradd user05

# passwd user05

-> user05 사용자의 암호 입력

 

# ls -al /etc/skel /home/user05      두 개의 디렉토리 안에 파일들이 동일한 것을 알 수 있음

[root@server1 ~]# ls -al /etc/skel /home/user05
/etc/skel:
합계 24K
drwxr-xr-x.   3 root root   78  8월  3 13:32 ./
drwxr-xr-x. 146 root root 8.0K  8월 31 00:13 ../
-rw-r--r--.   1 root root   18  7월 22  2020 .bash_logout
-rw-r--r--.   1 root root  141  7월 22  2020 .bash_profile
-rw-r--r--.   1 root root  376  7월 22  2020 .bashrc
drwxr-xr-x.   4 root root   39  8월  3 13:30 .mozilla/

/home/user05:
합계 12K
drwx------  3 user05 user05  78  8월 31 00:12 ./
drwxr-xr-x. 7 root   root    76  8월 31 00:12 ../
-rw-r--r--  1 user05 user05  18  7월 22  2020 .bash_logout
-rw-r--r--  1 user05 user05 141  7월 22  2020 .bash_profile
-rw-r--r--  1 user05 user05 376  7월 22  2020 .bashrc
drwxr-xr-x  4 user05 user05  39  8월  3 13:30 .mozilla/

 

# alias ll

[root@server1 ~]# alias ll
alias ll='ls -l --color=auto'

위의 내용 복사

 

# vi /etc/skel/.bashrc

-> 위의 alias 내용을 추가해주기

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
alias ll='ls -l --color=auto -F -h'

 

새로운 사용자 추가 생성

# useradd user06

# passwd user06  -> user06 사용자 암호 입력

 

# ls -al /etc/skel /home/user06

-rw-r--r--    1 root root  412  8월 31 00:15 .bashrc

-rw-r--r--  1 user06 user06 412  8월 31 00:15 .bashrc

[root@server1 ~]# ls -al /etc/skel /home/user06
/etc/skel:
합계 24K
drwxr-xr-x.   3 root root   78  8월 31 00:15 ./
drwxr-xr-x. 146 root root 8.0K  8월 31 00:16 ../
-rw-r--r--.   1 root root   18  7월 22  2020 .bash_logout
-rw-r--r--.   1 root root  141  7월 22  2020 .bash_profile
-rw-r--r--    1 root root  412  8월 31 00:15 .bashrc
drwxr-xr-x.   4 root root   39  8월  3 13:30 .mozilla/

/home/user06:
합계 12K
drwx------  3 user06 user06  78  8월 31 00:16 ./
drwxr-xr-x. 8 root   root    90  8월 31 00:16 ../
-rw-r--r--  1 user06 user06  18  7월 22  2020 .bash_logout
-rw-r--r--  1 user06 user06 141  7월 22  2020 .bash_profile
-rw-r--r--  1 user06 user06 412  8월 31 00:15 .bashrc
drwxr-xr-x  4 user06 user06  39  8월  3 13:30 .mozilla/

: /etc/skel 디렉토리 안의 내용을 변경했을 때 적용되는 시점은 새로운 사용자가 추가되었을 때임

: /etc/skel 디렉토리 안의 내용을 변경했을 때 이전 사용자 디렉토리 (기존에 추가된 사용자의 홈 디렉토리)에는 반영되지 않음)

-> ls -al /etc/skel /home/user05와 비교해보면 알 수 있음