728x90
.bashrc 파일 생성
/etc/skel 디렉토리에서는 사용자를 처음 생성했을 때 해당 계정의 홈 디렉토리에 기본으로 들어가는 파일을 지정한다. 즉 사용자 생성 시 /etc/skel 안에 있는 파일이 계정 홈 디렉토리로 복사된다.
useradd 명령으로 계정 생성 시 SKEL(SKEL=/etc/skel) 사용
$ cat /etc/default/useradd
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
- .bash_logout : 로그아웃할 때 자동으로 실행되는 스크립트
- .bash_profile : 로그인할 때 자동으로 실행되는 스크립트
- .bashrc : 로그인할 때 실행되는 스크립트
$ ls -al /etc/skel/
total 24
drwxr-xr-x 2 root root 4096 Mar 18 20:19 .
drwxr-xr-x 1 root root 4096 Apr 22 07:46 ..
-rw-r--r-- 1 root root 18 Oct 11 2021 .bash_logout
-rw-r--r-- 1 root root 141 Oct 11 2021 .bash_profile
-rw-r--r-- 1 root root 492 Oct 11 2021 .bashrc
skel(skeleton) 디렉터리에서 복사
cp -f /etc/skel/{.bashrc,.bash_logout,.bash_profile} .
root(/root) 디렉토리 파일 목록
[root@c389bf8fda2f ~]$ ls -al
total 24
dr-xr-x--- 1 root root 4096 Apr 22 07:52 .
drwxr-xr-x 1 root root 4096 Apr 22 07:45 ..
-rw------- 1 root root 441 Apr 22 07:52 .bash_history
-rw-r--r-- 1 root root 18 Apr 22 07:52 .bash_logout
-rw-r--r-- 1 root root 141 Apr 22 07:52 .bash_profile
-rw-r--r-- 1 root root 492 Apr 22 07:52 .bashrc
.bashrc(root) 파일
$ vim .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
.bashrc(user) 파일
$ vim .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
728x90
'리눅스' 카테고리의 다른 글
[리눅스] kill 명령어 (0) | 2022.04.23 |
---|---|
[리눅스] nginx 공격 아이피(attacker ip) 추출 (0) | 2022.04.23 |
[리눅스] command not found (0) | 2022.04.22 |
[리눅스] 록키 리눅스(Rocky Linux) 다운로드 (0) | 2022.04.22 |
[리눅스] Ubuntu Server 22.04 LTS 설치 (Jammy Jellyfish) (0) | 2022.04.21 |