

1. sshd 서비스 상태 확인
systemctl status sshd
2. sshd 서비스 시작
systemctl start sshd
systemctl status sshd
3. sshd 서비스 부팅 시 자동 시작 설정 (활성화)
systemctl enable sshd
systemctl list-unit-files | grep sshd
enabled로 바뀌었는지 확인4. sshd 서비스 중지
systemctl stop sshd
systemctl status sshd
Active: inactive (dead) 상태로 전환되는지 확인5. sshd 서비스 비활성화 (부팅 시 자동 실행 해제)
systemctl disable sshd
systemctl list-unit-files | grep sshd
disabled로 바뀌는지 확인6. sshd 서비스 잠금 (mask)
systemctl mask sshd
systemctl status sshd
maskedstart 명령어로도 실행 불가7. sshd 서비스 잠금 해제 (unmask)
systemctl unmask sshd
systemctl status sshd
start 가능8. sshd 서비스 시작 후 PID 확인
systemctl start sshd
systemctl status sshd
Main PID: xxxx → PID 기억해두기9. sshd 서비스 리로드 후 PID 확인 (변화 없음)
systemctl reload sshd
systemctl status sshd
10. sshd 서비스 재시작 후 PID 확인 (변화 있음)
systemctl restart sshd
systemctl status sshd
추가
reload: 설정 파일만 다시 읽음 (프로세스 그대로 유지)restart: 완전 재시작 (PID 변경)mask: 완전 실행 금지 → /dev/null로 링크목표
1. auth 기능에서 crit 이상 로그만 /var/log/securetest에 기록
2. logger로 auth.error, auth.crit 메시지 테스트
3. journalctl에서 notice 이상 + err 이상 로그 보기
1. rsyslog 설정 변경
vim /etc/rsyslog.conf
#### RULES #### 아래에 다음 한 줄 추가
auth.crit /var/log/securetest
의미
auth facility에서 crit 이상인 로그만 /var/log/securetest에 기록됨auth.error는 기록되지 않음, auth.crit은 기록됨설정 적용
systemctl restart rsyslog
2. logger 명령어로 로그 발생 테스트
logger -p auth.error "auth.error 메시지입니다"
logger -p auth.crit "auth.critical 메시지입니다"
로그 확인
tail -n 5 /var/log/secure
→ 둘 다 기록됨 (auth.error, auth.crit)
tail -n 5 /var/log/securetest
→ 오직 auth.crit만 기록됨
3. journalctl 우선순위 필터링
notice(5) 이상 (즉, notice, warn, err, crit, alert, emerg)
journalctl -p notice
err(3) 이상 (즉, err, crit, alert, emerg)
journalctl -p err
실시간으로 모니터링하려면?
journalctl -p err -f
1. 패키지 정보 확인
rpm -q [옵션] [패키지명]
-a: 시스템에 설치된 모든 패키지
-i: 패키지의 상세 정보 (설명, 버전, 설치일 등)
-c: 설정 파일 목록
-d: 문서 목록
-l: 설치된 파일 목록
-f 파일명: 해당 파일이 어떤 패키지에 속하는지
2. 패키지 설치 / 업데이트 / 삭제
설치 또는 업그레이드
rpm -Uvh 패키지파일.rpm
삭제
rpm -e 패키지명
.rpm 파일은 로컬에 있어야 함
1. 기본 명령어
yum install 패키지명
yum remove 패키지명
yum update 패키지명
yum info 패키지명
yum list
yum provides /경로/파일명
yum repolist all # 사용 가능한 저장소 목록 보기
2. 그룹 패키지 관리
yum group list
yum group install "개발 도구"
yum group remove "서버 플랫폼 개발"
yum group info "보안 도구"
3. 로컬 패키지 설치 (의존성 포함)
yum localinstall 패키지.rpm
# 예시 /etc/yum.repos.d/base.repo
[BaseOS]
name=RockLinux BaseOS
baseurl=http://mirror.rocklinux.com/BaseOS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RockLinux
metadata_expire=6h
[ID명]: 저장소 식별자
name: 저장소 설명
baseurl: 저장소 주소 (http, ftp, file://)
enabled: 1=활성화 / 0=비활성화
gpgcheck: 패키지 인증 여부
gpgkey: 인증 키 경로
metadata_expire: 메타데이터 만료시간
BaseOS: 핵심 시스템 구성 (커널, 부트 등)
AppStream: DB, 웹서버, 개발도구 등 자주 업데이트되는 앱들
dnf makecache
1. DVD 마운트 & 준비
umount /dev/cdrom
mkdir -p /media/cdrom
mount /dev/cdrom /media/cdrom
lsblk # 마운트 확인
2. Repository 설정
cd /etc/yum.repos.d/
mkdir backup
mv rocky* backup/
vim test.repo
[NET_BaseOs]
name=network-baseos
baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/`
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[NET_AppStream]
name=network-appstream
baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
3. 캐시 재생성 & 저장소 확인
dnf makecache
dnf repolist all
4. NET_AppStream 비활성화
vim test.repo
[NET_AppStream]
...
enabled=0
dnf repolist all # 비활성화 확인
5. telnet 관련 패키지 검색
dnf list | grep telnet
6. telnet 패키지 설치 & socket 활성화
dnf install telnet*
systemctl enable telnet.socket --now
텔넷이 다운되어있지 않다면?
vim test.repo
[NET_AppStream]
...
enabled=1
dnf install telnet-server
[NET_AppStream]
...
enabled=0
7. telnet 설정파일 & 문서 확인
rpm -qc telnet # config files
rpm -qd telnet # doc files
8. rsyslog.conf가 어떤 패키지에서 나왔는지 확인
rpm -qf /etc/rsyslog.conf
dnf provides /etc/rsyslog.conf
9. rsyslog 패키지 정보 확인
rpm -qi rsyslog
dnf info rsyslog
10. Security 관련 그룹 패키지 찾기
dnf group list | grep -i security
→ 예시 결과: Security Tools or 보안 도구
11. 해당 그룹의 상세 정보 확인
dnf group info "Security Tools"
12. zsh RPM 파일 yum으로 설치
dnf localinstall /media/cdrom/BaseOS/Packages/z/zsh-5.8-9.el9.x86_64.rpm
네트워크 상태 확인
ip addr
ip addr show 인터페이스명
ifconfig
ifconfig 인터페이스명
기본 명령
nmcli device: 장치(device) 목록 확인
nmcli con show: 현재 연결 목록 확인
nmcli con show 연결명: 연결 상세 설정 보기
nmcli con add ...: 연결 생성
nmcli con mod ...: 연결 수정
nmcli con delete ...: 연결 삭제
nmcli con up 연결명: 연결 활성화
nmcli con down 연결명: 연결 비활성화
nmcli con reload: 연결 설정 재적용
유동 IP 설정 (DHCP 방식)
nmcli con add \
con-name dhcp7 \
ifname enp0s7 \
type ethernet \
autoconnect yes
ipv4.method 자동 설정 → auto고정 IP 설정 (Static 방식)
nmcli con add \
con-name static7 \
ifname enp0s7 \
type ethernet \
autoconnect no \
ip4 10.100.5.100/24 \
gw4 10.100.5.2 \
ipv4.method manual
ipv4.method manual 반드시 포함연결 상태 확인
nmcli con show static7
connection.autoconnect: yes / noipv4.method: auto / manualipv4.addresses, ipv4.gatewayDHCP → 고정 IP 변경
nmcli con mod dhcp7 \
connection.id static7-1 \
ipv4.method manual \
ipv4.addresses 10.100.5.200/24 \
ipv4.gateway 10.100.5.2 \
ipv4.dns 10.100.5.100
고정 IP → DHCP 변경
nmcli con mod static7 \
connection.id dhcp7-1 \
ipv4.method auto \
ipv4.addresses "" \
ipv4.gateway "" \
ipv4.dns "8.8.8.8 10.100.5.100" \
connection.autoconnect yes
hostname: 현재 호스트명 확인
cat /etc/hostname: 설정된 호스트명 파일 확인
hostnamectl set-hostname 새이름: 호스트명 변경
추가
connection.id 사용nmcli con delete 연결명nmcli con up 연결명 으로 적용기억하면 좋은 포인트
ipv4.method manual → 꼭 고정 IP 설정에 필요ip4, gw4 → IP와 게이트웨이 주소 설정ipv4.dnsnmcli con reload로 설정 리로드전체 IP 확인
ifconfig
ip addr
특정 인터페이스(eth2) 확인
ifconfig eth2
ip addr show eth2
1. 유동 IP 연결 생성 (DHCP 방식)
nmcli con add con-name dhcp type ethernet ifname eth2
2. 고정 IP 연결 생성 (Static 방식)
nmcli con add \
con-name static2 \
type ethernet \
ifname eth2 \
ip4 192.168.56.200/24 \
gw4 192.168.56.1
기존 dhcp 연결을 다음과 같이 수정
static으로 변경192.168.56.120/24 설정192.168.56.30/248.8.8.8nmcli con mod dhcp \
connection.id static \
ipv4.addresses 192.168.56.120/24 \
ipv4.gateway 192.168.56.1 \
+ipv4.addresses 192.168.56.30/24 \
ipv4.dns 8.8.8.8 \
connection.autoconnect no \
ipv4.method manual
nmcli con mod static -ipv4.addresses 192.168.56.120/24
hostnamectl hostname nobreak.com
변경확인
hostname
IP 전체 확인: ip addr / ifconfig
eth2 확인: ip addr show eth2
DHCP 연결 생성: nmcli con add con-name dhcp ...
Static 연결 생성: nmcli con add con-name static2 ...
연결 이름/속성 변경: nmcli con mod ...
주소 제거: nmcli con mod static -ipv4.addresses 주소/넷마스크
호스트명 설정: hostnamectl hostname 호스트명

또 나왔습니당