1교시 09:30 ~ 10:30>
프로그램 - 프로세스
프로그램 : disk에 저장되어있는 실행파일
(linx : 2진파일, Windows: 응용프로그램)
프로세스 : 메모리에 공간을 할당받아 실행중인 상태
[root@server1 ~]# pstree
systemd─┬─ModemManager───2*[{ModemManager}]
├─NetworkManager───2*[{NetworkManager}]
├─VGAuthService
├─accounts-daemon───2*[{accounts-daemon}]
├─alsactl
├─atd
├─auditd─┬─sedispatch
│ └─2*[{auditd}]
├─avahi-daemon───avahi-daemon
├─bluetoothd
├─colord───2*[{colord}]
├─crond
├─cupsd
├─dbus-daemon───{dbus-daemon}
├─dnsmasq───dnsmasq
├─firewalld───{firewalld}
├─gdm─┬─gdm-session-wor─┬─gdm-wayland-ses─┬─gnome-session-b─┬─gnome-shell─┬─Xwayland───12*[{Xwa+
│ │ │ │ │ ├─ibus-daemon─┬─ibus-+
│ │ │ │ │ │ ├─ibus-+
│ │ │ │ │ │ └─2*[{i+
│ │ │ │ │ └─19*[{gnome-shell}]
│ │ │ │ ├─gsd-a11y-settin───3*[{gsd-a11y-se+
│ │ │ │ ├─gsd-clipboard───2*[{gsd-clipboard+
│ │ │ │ ├─gsd-color───3*[{gsd-color}]
│ │ │ │ ├─gsd-datetime───2*[{gsd-datetime}]
│ │ │ │ ├─gsd-housekeepin───2*[{gsd-houseke+
│ │ │ │ ├─gsd-keyboard───3*[{gsd-keyboard}]
│ │ │ │ ├─gsd-media-keys───3*[{gsd-media-ke+
│ │ │ │ ├─gsd-mouse───2*[{gsd-mouse}]
│ │ │ │ ├─gsd-power───3*[{gsd-power}]
│ │ │ │ ├─gsd-print-notif───2*[{gsd-print-n+
│ │ │ │ ├─gsd-rfkill───2*[{gsd-rfkill}]
│ │ │ │ ├─gsd-screensaver───2*[{gsd-screens+
│ │ │ │ ├─gsd-sharing───3*[{gsd-sharing}]
│ │ │ │ ├─gsd-smartcard───5*[{gsd-smartcard+
│ │ │ │ ├─gsd-sound───3*[{gsd-sound}]
│ │ │ │ ├─gsd-wacom───3*[{gsd-wacom}]
│ │ │ │ ├─gsd-xsettings───3*[{gsd-xsettings+
│ │ │ │ └─3*[{gnome-session-b}]
│ │ │ └─2*[{gdm-wayland-ses}]
│ │ └─2*[{gdm-session-wor}]
│ └─2*[{gdm}]
├─gssproxy───5*[{gssproxy}]
├─ibus-x11───14*[{ibus-x11}]
├─irqbalance───{irqbalance}
├─ksmtuned───sleep
├─lsmd
├─mcelog
├─packagekitd───2*[{packagekitd}]
├─polkitd───7*[{polkitd}]
├─rhsmcertd
├─rpcbind
├─rsyslogd───2*[{rsyslogd}]
├─rtkit-daemon───2*[{rtkit-daemon}]
├─smartd
├─sshd───sshd───sshd───bash───pstree
├─sssd─┬─sssd_be
│ └─sssd_nss
├─systemd─┬─(sd-pam)
│ ├─dbus-daemon───{dbus-daemon}
│ ├─gvfsd───2*[{gvfsd}]
│ └─gvfsd-fuse───5*[{gvfsd-fuse}]
├─systemd─┬─(sd-pam)
│ ├─at-spi-bus-laun─┬─dbus-daemon───{dbus-daemon}
│ │ └─3*[{at-spi-bus-laun}]
│ ├─at-spi2-registr───2*[{at-spi2-registr}]
│ ├─dbus-daemon───{dbus-daemon}
│ ├─ibus-portal───2*[{ibus-portal}]
│ ├─pulseaudio───2*[{pulseaudio}]
│ └─xdg-permission-───2*[{xdg-permission-}]
├─systemd-journal
├─systemd-logind
├─systemd-machine
├─systemd-udevd
├─tuned───3*[{tuned}]
├─udisksd───4*[{udisksd}]
├─upowerd───2*[{upowerd}]
├─vmtoolsd───2*[{vmtoolsd}]
└─wpa_supplicant
사용자 권한에 따라서 실행할 수 있는 레벨이 틀림
[root@server1 ~]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 1921 1914 0 80 0 - 6922 - pts/0 00:00:00 bash
0 R 0 2165 1921 0 80 0 - 11368 - pts/0 00:00:00 ps
zombie가 되면 메모리에서 클린업이되지 않기때문에 정리 해줘야 된다.
PID 현재 프로세스의 ID(숫자, /proc)
PPID 부모 PID
[root@server1 ~]# ps -ef | head -10
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 09:33 ? 00:00:04 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root 2 0 0 09:33 ? 00:00:00 [kthreadd]
root 3 2 0 09:33 ? 00:00:00 [rcu_gp]
root 4 2 0 09:33 ? 00:00:00 [rcu_par_gp]
root 5 2 0 09:33 ? 00:00:01 [kworker/0:0-events]
root 6 2 0 09:33 ? 00:00:00 [kworker/0:0H-events_highpri]
root 9 2 0 09:33 ? 00:00:00 [mm_percpu_wq]
root 10 2 0 09:33 ? 00:00:00 [ksoftirqd/0]
root 11 2 0 09:33 ? 00:00:00 [rcu_sched]
UID 모든 프로세스는 소유자가 존재 해당 프로세스를 실행시킨, 소유하고 있는 소유자의 이름
PID 프로세스 아이디, 프로세스 식별번호
PPID 부모 프세스 아이디
C 현재 사용되지 않는 필드
STIME(Start Time) 프로세스 실행 시 시간
TTY 제어 터미널, 프로세스가 실행된 터미널
TIME CPU 사용 누적 시간
CMD 명령어(옵션 + 인자 포함)
포그라운드 : 쉘을 점유
---bash---
백그라운드 : 쉘을 미점유
포그라운드 : 쉘을 프로세스가 점유한 상태이기 때문에 프로세스가 종료 될때까지 입력한 명령어가 명령어로
실행되지 않고 해당 프로세스에 의해 작업된다.
쉘이 점유된 상태라면 프로세스가 종료될때까지 더이상 실행이 불가
[root@server1 ~]# sleep 10m
백그라운드 : 프로세스를 실행시킬때 백그라운드 형태로 실행이 되면 쉘을 계속 사용 가능
[root@server1 ~]# sleep 10m &
[1] 2350
[root@server1 ~]# echo $!
2350
백그라운드 형태로 작업을 하는 경웽는 명령어 마지막에 &를 입력한다.
2교시 10:40 ~ 11:40>
[root@server1 ~]# yum -y install tmux
Last metadata expiration check: 0:15:34 ago on Sat 15 Jan 2022 10:23:36 AM KST.
Dependencies resolved.
========================================================================================================
Package Architecture Version Repository Size
========================================================================================================
Installing:
tmux x86_64 2.7-1.el8 baseos 317 k
Transaction Summary
========================================================================================================
Install 1 Package
Total download size: 317 k
Installed size: 781 k
Downloading Packages:
tmux-2.7-1.el8.x86_64.rpm 1.2 MB/s | 317 kB 00:00
--------------------------------------------------------------------------------------------------------
Total 360 kB/s | 317 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : tmux-2.7-1.el8.x86_64 1/1
Running scriptlet: tmux-2.7-1.el8.x86_64 1/1
Verifying : tmux-2.7-1.el8.x86_64 1/1
Installed products updated.
Installed:
tmux-2.7-1.el8.x86_64
Complete!
[root@server1 ~]# tmux new -s test
1. 터미널을 완전 종료하더라도 백그라운드에서 계속 실행되고 있는 bash shell
2. 로그 파일, 수집 등 여러 작업을 하는 경우 터미널에 문자가 출력이 많아지는 경우 bash 메모리 사용량이 증가
# 새로운 세션 생성
tmux new -s (session_name)
# 세션 만들면서 윈도우랑 같이 생성
tmux new -s (session_name) -n (window_name)
# 세션 종료
exit
# 세션 목록
tmux ls
# 세션 다시 시작하기(다시 불러오기)
tmux attach -t session_number
# 세션 중단하기
(ctrl + b) d
# 스크롤하기
ctrl + b + [
# 특정 세션 강제 종료
tmux kill-session -t session_number
사용이유 : bash shell을 계속 연결시켜 두기가 힘든 상황 작업을 이어나가야 한다.
[root@server1 proc]# cat &
[1] 3149
[root@server1 proc]# jobs
[1]+ Stopped cat
[root@server1 proc]# cd /proc/3149
[root@server1 3149]#
[root@server1 3149]# fg 1
cat (wd: /proc)
^C
[root@server1 ~]# sleep 10m
^Z
[1]+ Stopped sleep 10m
[root@server1 ~]# jobs
[1]+ Stopped sleep 10m
[root@server1 ~]# bg 1
[1]+ sleep 10m &
[root@server1 ~]# jobs
[1]+ Running sleep 10m &
[root@server1 ~]# sleep 15m &
[2] 3170
[root@server1 ~]# jobs
[1]- Running sleep 10m &
[2]+ Running sleep 15m &
[root@server1 ~]# fg 1
sleep 10m
^C
[root@server1 ~]# jobs
[2]+ Running sleep 15m &
백그라운드 프로세스의 관리 / 쉘을 빠져나가는 순간 / jobs 명령어에서는 관리가 불가능
kill -1 / SIGHUP / 프로세스 재시작(HangUp)
kill -2 / SIGINT / 인터럽트(Interrput, ctrl + c)
kill -9 / SIGKILL / 강제종료(force exit signal) / 메모리와 디스크를 클린업 한 뒤 종료
kill -15 / SIGTERM / 정상종료(exit / 기본 시그널) / 그냥 종료
[root@server1 ~]# sync ; sync
md5sum 데이터 무결성 검사
[root@server1 ~]# md5sum anaconda-ks.cfg
02ec3b617b11a2180ca47c8923b3c5f7 anaconda-ks.cfg
[root@server1 ~]# cp anaconda-ks.cfg file1
[root@server1 ~]# md5sum file1
02ec3b617b11a2180ca47c8923b3c5f7 file1
[root@server1 ~]# jobs
[1] Running sleep 10m &
[2] Running sleep 15m &
[3]- Running sleep 20m &
[4]+ Running sleep 25m &
[root@server1 ~]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
3529 pts/0 00:00:00 sleep
3530 pts/0 00:00:00 sleep
3532 pts/0 00:00:00 sleep
3541 pts/0 00:00:00 sleep
3542 pts/0 00:00:00 ps
[root@server1 ~]# kill 3529
[root@server1 ~]# jobs
[1] Terminated sleep 10m
[2] Running sleep 15m &
[3]- Running sleep 20m &
[4]+ Running sleep 25m &
[root@server1 ~]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
3530 pts/0 00:00:00 sleep
3532 pts/0 00:00:00 sleep
3541 pts/0 00:00:00 sleep
3543 pts/0 00:00:00 ps
[root@server1 ~]# kill -9 3530
[root@server1 ~]# jobs
[2] Killed sleep 15m
[3]- Running sleep 20m &
[4]+ Running sleep 25m &
[root@server1 ~]# killall sleep
[3]- Terminated sleep 20m
[4]+ Terminated sleep 25m
[root@server1 ~]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
3561 pts/0 00:00:00 ps
[root@server1 ~]#
3교시 11:50 ~ 12:50>
[root@server1 ~]# top -d 1
top - 11:34:08 up 2:00, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 235 total, 2 running, 233 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3902.5 total, 2562.4 free, 666.9 used, 673.3 buff/cache
MiB Swap: 4032.0 total, 4032.0 free, 0.0 used. 2987.6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3718 root 20 0 65576 5144 4224 R 1.0 0.1 0:00.19 top
1 root 20 0 252452 14696 9668 S 0.0 0.4 0:05.15 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-events_highpri
9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
10 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/0
11 root 20 0 0 0 0 R 0.0 0.0 0:00.81 rcu_sched
12 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
13 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
16 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/1
17 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
18 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/1
20 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/1:0H-events_highpri
21 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/2
22 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/2
23 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/2
24 root 20 0 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/2
26 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/2:0H-events_highpri
27 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/3
28 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/3
29 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/3
30 root 20 0 0 0 0 S 0.0 0.0 0:00.08 ksoftirqd/3
32 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/3:0H-events_highpri
36 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kdevtmpfs
37 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns
38 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kauditd
42 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
43 root 20 0 0 0 0 S 0.0 0.0 0:00.00 oom_reaper
44 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 writeback
45 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kcompactd0
46 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
47 root 39 19 0 0 0 S 0.0 0.0 0:00.58 khugepaged
48 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 crypto
49 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kintegrityd
50 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kblockd
51 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 blkcg_punt_bio
53 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 tpm_dev_wq
54 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 md
55 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 edac-poller
56 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdogd
top - 11:34:08 up 2:00, 1 user, load average: 0.00, 0.00, 0.00
시스템의 현재 시간과 시스템이 부팅된 후 작동한 시간, 현재 사용자 수를 보여주며, load average는 cpu 로드의 평균 값
load average는 lscpu를 쳐서 cpu 쪽을 보고 나눗셈을 해줘서 측정할 수 있다.
[root@server1 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
BIOS Vendor ID: GenuineIntel
CPU family: 6
Model: 126
Model name: Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz
BIOS Model name: Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz
Stepping: 5
CPU MHz: 1497.601
BogoMIPS: 2995.20
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 48K
L1i cache: 32K
L2 cache: 512K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid avx512f avx512dq rdseed adx smap clflushopt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xsaves arat pku ospke avx512_vpopcntdq md_clear flush_l1d arch_capabilities
Tasks: 235 total, 2 running, 233 sleeping, 0 stopped, 0 zombie
시스템에 동작중인 프로세스의 상태를 보여준다.
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
CPU 상태를 보여준다. 99.8 id(CPU 사용률 / 주시 대상) 0.0 si, 0.0 st(가상머신)
MiB Mem : 3902.5 total, 2562.4 free, 666.9 used, 673.3 buff/cache (물리메모리)
MiB Swap: 4032.0 total, 4032.0 free, 0.0 used. 2987.6 avail Mem (가상메모리)
총 사용 가능 메모리, 사용된 메모리, 사용할 수 있는 메모리, 공유메모리, 버퍼로 사용된 메모리, 스왑 메모리 등
메모리에 관한 정보를 보여준다. 각각의 시스템 자원에 따른 프로세스의 점유율을 확인 할 수 있다.
buff/cache : 디스크에 있는 파일의 내용을 유지하는 메모리 공간
buff : 파일정보(메타 데이터)
cache : 실제 파일 내용
preload / prielink
[root@server1 ~]# free
total used free shared buff/cache available
Mem: 3996172 682164 2624468 11104 689540 3060040
Swap: 4128764 0 4128764
[root@server1 ~]# free -h
total used free shared buff/cache available
Mem: 3.8Gi 665Mi 2.5Gi 10Mi 673Mi 2.9Gi
Swap: 3.9Gi 0B 3.9Gi
모니터링 도구 glances
[root@server1 ~]# yum -y install epel-release
[root@server1 ~]# yum -y install glances
[root@server1 ~]# glances
server1.example.com (CentOS Linux 8.4.2105 64bit / Linux 4.18.0-305.3.1.el8.x86_64) Uptime: 2:57:20
CPU [ 2.4%] CPU - 2.4% MEM - 33.4% SWAP - 0.0% LOAD 4-core
MEM [ 33.4%] user: 0.9% total: 3.81G total: 3.94G 1 min: 0.10
SWAP [ 0.0%] system: 1.2% used: 1.27G used: 780K 5 min: 0.07
idle: 97.6% free: 2.54G free: 3.94G 15 min: 0.22
NETWORK Rx/s Tx/s TASKS 244 (415 thr), 1 run, 167 slp, 76 oth sorted automatically
ens33 312b 2Kb
lo 0b 0b CPU% MEM% VIRT RES PID USER TIME+ THR NI S R/s W/s
virbr0 0b 0b 8.9 0.9 222M 36.2M 109999 root 0:04 1 0 R 0 0 /us
0.7 1.0 224M 39.6M 1001 root 0:01 1 0 S 0 0 /us
TCP CONNECTIONS 0.3 0.3 357M 11.4M 955 root 0:13 3 0 S 0 0 /us
Listen 7 0.3 0.0 0 0 3864 root 0:01 1 0 ? 0 0 [kw
Initiated 0 0.0 6.5 3.68G 254M 1524 gdm 0:12 20 0 S 0 0 /us
Established 2 0.0 4.4 820M 171M 1723 root 0:14 3 0 S 0 0 /us
Terminated 0 0.0 1.6 1.36G 60.8M 1673 gdm 0:00 15 0 S 0 0 /us
Tracked 15/65536 0.0 1.5 463M 57.2M 4068 root 0:01 2 0 S 0 0 /us
0.0 1.3 1.10G 52.0M 1637 gdm 0:00 13 0 S 0 0 /us
FILE SYS Used Total 0.0 1.0 290M 40.1M 1013 root 0:01 2 0 S 0 0 /us
/ (cl-root) 8.09G 63.8G 0.0 0.7 407M 27.8M 1151 root 0:02 4 0 S 0 0 /us
/boot 225M 1014M 0.0 0.7 1.69G 27.1M 942 polkitd 0:01 8 0 S 0 0 /us
/home 255M 31.2G 0.0 0.7 1.07G 26.5M 1752 gdm 0:00 4 0 S 0 0 /us
2022-01-15 12:30:51 KST
[root@server1 ~]# systemctl start cockpit.socket
[root@server1 ~]# systemctl stop cockpit.socket
<terminal01>
[root@server1 bin]# vi cpu.sh
[root@server1 bin]# vi cpu2.sh
[root@server1 bin]# vi cpu3.sh
[root@server1 bin]# chmod 700 cpu*
[root@server1 bin]# ls
cpu2.sh cpu3.sh cpu.sh
[root@server1 bin]# vi disk_exhaust.c
[root@server1 bin]# vi mem.c
[root@server1 bin]# ls
cpu2.sh cpu3.sh cpu.sh disk_exhaust.c mem.c
[root@server1 bin]# gcc -o mem mem.c ; gcc -o disk_exhaust disk_exhaust.c
<terminal02>
[root@server1 ~]# yum -y install gcc*
[root@server1 ~]# top
[root@server1 bin]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
109359 pts/0 00:00:00 ps
[root@server1 bin]# lsof -p 3312
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 3312 root cwd DIR 253,0 116 480360 /root/bin
bash 3312 root rtd DIR 253,0 262 128 /
bash 3312 root txt REG 253,0 1150736 426499 /usr/bin/bash
bash 3312 root mem REG 253,0 2586930 426334 /usr/lib/locale/en_US.utf8/LC_COLLATE
bash 3312 root mem REG 253,0 83760 33962578 /usr/lib64/libnss_files-2.28.so
bash 3312 root DEL REG 253,0 925752 /var/lib/sss/mc/passwd
bash 3312 root mem REG 253,0 46272 34830595 /usr/lib64/libnss_sss.so.2
bash 3312 root mem REG 253,0 3167872 33962566 /usr/lib64/libc-2.28.so
bash 3312 root mem REG 253,0 28856 33962568 /usr/lib64/libdl-2.28.so
bash 3312 root mem REG 253,0 208616 33962486 /usr/lib64/libtinfo.so.6.1
bash 3312 root mem REG 253,0 278512 33962549 /usr/lib64/ld-2.28.so
bash 3312 root mem REG 253,0 337024 1143184 /usr/lib/locale/en_US.utf8/LC_CTYPE
bash 3312 root mem REG 253,0 54 1143186 /usr/lib/locale/en_US.utf8/LC_NUMERIC
bash 3312 root mem REG 253,0 3316 36658611 /usr/lib/locale/en_US.utf8/LC_TIME
bash 3312 root mem REG 253,0 286 36658609 /usr/lib/locale/en_US.utf8/LC_MONETARY
bash 3312 root mem REG 253,0 57 33962540 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
bash 3312 root mem REG 253,0 34 101052825 /usr/lib/locale/en_US.utf8/LC_PAPER
bash 3312 root mem REG 253,0 77 426337 /usr/lib/locale/en_US.utf8/LC_NAME
bash 3312 root mem REG 253,0 167 33962523 /usr/lib/locale/en_US.utf8/LC_ADDRESS
bash 3312 root mem REG 253,0 59 36658610 /usr/lib/locale/en_US.utf8/LC_TELEPHONE
bash 3312 root mem REG 253,0 23 36658608 /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
bash 3312 root mem REG 253,0 26998 67619205 /usr/lib64/gconv/gconv-modules.cache
bash 3312 root mem REG 253,0 368 36658607 /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
bash 3312 root 0u CHR 136,0 0t0 3 /dev/pts/0
bash 3312 root 1u CHR 136,0 0t0 3 /dev/pts/0
bash 3312 root 2u CHR 136,0 0t0 3 /dev/pts/0
bash 3312 root 3r REG 253,0 9253600 925752 /var/lib/sss/mc/passwd (deleted)
bash 3312 root 4u unix 0xffff963477fbf980 0t0 59596 type=STREAM
bash 3312 root 255u CHR 136,0 0t0 3 /dev/pts/0
[root@server1 bin]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
109370 pts/0 00:00:00 ps
[root@server1 bin]# pmap 3312
3312: -bash
00005561c628b000 1056K r-x-- bash
00005561c6592000 16K r---- bash
00005561c6596000 36K rw--- bash
00005561c659f000 40K rw--- [ anon ]
00005561c725e000 2076K rw--- [ anon ]
00007f4abac9e000 2528K r---- LC_COLLATE
00007f4abaf16000 44K r-x-- libnss_files-2.28.so
00007f4abaf21000 2048K ----- libnss_files-2.28.so
00007f4abb121000 4K r---- libnss_files-2.28.so
00007f4abb122000 4K rw--- libnss_files-2.28.so
00007f4abb123000 24K rw--- [ anon ]
00007f4abb129000 9040K r--s- passwd (deleted)
00007f4abb9fd000 40K r-x-- libnss_sss.so.2
00007f4abba07000 2044K ----- libnss_sss.so.2
00007f4abbc06000 4K r---- libnss_sss.so.2
00007f4abbc07000 4K rw--- libnss_sss.so.2
00007f4abbc08000 1776K r-x-- libc-2.28.so
00007f4abbdc4000 2044K ----- libc-2.28.so
00007f4abbfc3000 16K r---- libc-2.28.so
00007f4abbfc7000 8K rw--- libc-2.28.so
00007f4abbfc9000 16K rw--- [ anon ]
00007f4abbfcd000 12K r-x-- libdl-2.28.so
00007f4abbfd0000 2044K ----- libdl-2.28.so
00007f4abc1cf000 4K r---- libdl-2.28.so
00007f4abc1d0000 4K rw--- libdl-2.28.so
00007f4abc1d1000 164K r-x-- libtinfo.so.6.1
00007f4abc1fa000 2044K ----- libtinfo.so.6.1
00007f4abc3f9000 16K r---- libtinfo.so.6.1
00007f4abc3fd000 4K rw--- libtinfo.so.6.1
00007f4abc3fe000 176K r-x-- ld-2.28.so
00007f4abc580000 260K rw--- [ anon ]
00007f4abc5c1000 332K r---- LC_CTYPE
00007f4abc614000 4K r---- LC_NUMERIC
00007f4abc615000 4K r---- LC_TIME
00007f4abc616000 4K r---- LC_MONETARY
00007f4abc617000 4K r---- SYS_LC_MESSAGES
00007f4abc618000 4K r---- LC_PAPER
00007f4abc619000 12K rw--- [ anon ]
00007f4abc61c000 4K r---- LC_NAME
00007f4abc61d000 4K r---- LC_ADDRESS
00007f4abc61e000 4K r---- LC_TELEPHONE
00007f4abc61f000 4K r---- LC_MEASUREMENT
00007f4abc620000 28K r--s- gconv-modules.cache
00007f4abc627000 4K r---- LC_IDENTIFICATION
00007f4abc628000 8K rw--- [ anon ]
00007f4abc62a000 4K r---- ld-2.28.so
00007f4abc62b000 8K rw--- ld-2.28.so
00007ffce1047000 132K rw--- [ stack ]
00007ffce111b000 16K r---- [ anon ]
00007ffce111f000 8K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 28188K
[root@server1 bin]# ps
PID TTY TIME CMD
3312 pts/0 00:00:00 bash
109381 pts/0 00:00:00 ps
[root@server1 bin]# bash
[root@server1 bin]# pstree -p 3312
bash(3312)───bash(109382)───pstree(109420)
[root@server1 bin]#
4교시 11:50 ~ 13:30>
nice / renice : 우선순위에 대한 명령어(지정범위 -20 ~ 19)
- nice 명령어 : 프로그램을 실행할 때 프로세스의 우선순위를 설정할 수 있는 명령어
- renice 명령어 : 실행중인 프로그램의 우선순위를 조정할 수 있는 명령어
사용자 프로세스에 대한 우선순위 관리
PRI NI
80 0
60 -20
99 19
-20 우선 순위 높음
19 우선 순위 낮음
프로세스의 우선순위: 프로세스가 운영체제의 CPU를 선점할 수 있는 권한
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 6959 - pts/0 00:00:00 bash
0 R 0 110526 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# sleep 15m &
[1] 110562
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 6959 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110565 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# nice -10 sleep 15m &
[2] 110588
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 6959 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110591 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# nice --5 sleep 20m &
[3] 110633
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 6959 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110633 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110640 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# nice --20 sleep 25m &
[4] 110653
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 6959 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110633 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110653 109382 0 60 -20 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110656 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]#
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 7024 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110633 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110653 109382 0 60 -20 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110697 109382 0 99 19 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110764 109382 0 99 19 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110856 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# renice -n -5 110764
110764 (process ID) old priority 19, new priority -5
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 7024 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110633 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110653 109382 0 60 -20 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110697 109382 0 99 19 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110764 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110909 109382 1 80 0 - 11369 - pts/0 00:00:00 ps
[root@server1 bin]# renice -n 18 110764
110764 (process ID) old priority -5, new priority 18
[root@server1 bin]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 3312 3307 0 80 0 - 7046 - pts/0 00:00:00 bash
0 S 0 109382 3312 0 80 0 - 7024 - pts/0 00:00:00 bash
0 S 0 110562 109382 0 80 0 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110588 109382 0 90 10 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110633 109382 0 75 -5 - 1830 hrtime pts/0 00:00:00 sleep
4 S 0 110653 109382 0 60 -20 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110697 109382 0 99 19 - 1830 hrtime pts/0 00:00:00 sleep
0 S 0 110764 109382 0 98 18 - 1830 hrtime pts/0 00:00:00 sleep
0 R 0 110941 109382 0 80 0 - 11369 - pts/0 00:00:00 ps
프로세스를 기본 실행하면 NICE값은 기본값으로 실행되고 우선순위값은 80으로 실행
- ssh Secure Shell(원격 접속) : telnet, rlogin
- scp Secure Copy (파일 전송) : rcp
- sftp Secure FTP (파일 전송) : ftp
server1 : 192.168.10.200
server2 : 192.168.10.252
ssh auto login > scp
비밀번호를 입력해야 하는 불편함
host 파일 호스트 등록
ssh root@server2
server1>
[root@server1 ~]# vi /etc/hosts
192.168.10.200 server1.example.com server1
192.168.10.252 server2.example.com server2
[root@server1 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:nO7GmaTb6+aFPL2F+vN60Dmcxhi5O6pwlMUJ40/w25c root@server1.example.com
The key's randomart image is:
+---[RSA 3072]----+
| + |
| . * . |
| . * . |
| * +o . |
| o S .BEo |
| . o.o+oO |
| . .+=o++.. |
| o.o*++o. |
| oBO++*. |
+----[SHA256]-----+
[root@server1 ~]# cd .ssh
[root@server1 .ssh]# ls
id_rsa id_rsa.pub
[root@server1 ~]# ssh-keygen -N '' -f /root/.ssh/id_rsa -t rsa -b 4096
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:v2vFgFcoXBYIR1t41vzEHYoxrIEh7CDteUjwuaV5pM0 root@server1.example.com
The key's randomart image is:
+---[RSA 4096]----+
| .o ...==+*B . o.|
| ..+...o==+.B + .|
| +o=o .=oo + |
| +Xo ..o . |
| =.E S. o |
| . . o |
| .. |
| .. |
| .o. |
+----[SHA256]-----+
[root@server1 ~]# cd .ssh
[root@server1 .ssh]# ls
id_rsa id_rsa.pub
[root@server1 .ssh]# ssh-copy-id root@server2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'server2 (192.168.10.252)' can't be established.
ECDSA key fingerprint is SHA256:leJdeC48gb4bbpUED7VscrchQt0+Nakio2INcTFBUzI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@server2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@server2'"
and check to make sure that only the key(s) you wanted were added.
[root@server1 .ssh]# ssh root@server2
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Jan 15 13:06:55 2022 from 192.168.10.200
[root@server2 ~]#
semanage port -a -t ssh_port_t -p tcp 22222
systemctl restart sshd
firewall-cmd --add-port=22222/tcp
5교시 14:30 ~ 15:30>
rpm -ql ssh-clients
ssh-keygen 인증키 생성
ssh-copy-id 리모트 서버로 공개 인증키 내보내기
[root@server2 ~]# vi /etc/ssh/sshd_config
[root@server2 ~]# systemctl restart sshd
비밀번호가 존재하는 상태로 생성
[root@server1 ~]# ssh-keygen -f /root/.ssh/server2 -N 'redhat' -t rsa -b 4096
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/server2.
Your public key has been saved in /root/.ssh/server2.pub.
The key fingerprint is:
SHA256:J79h4Frt61dK48esy1eEcyrl7f4ITyvxPIrWMTlGZIQ root@server1.example.com
The key's randomart image is:
+---[RSA 4096]----+
| o. |
| E o |
| o . |
| . + o|
| S .. + * |
| . * @ + o|
| o ==.#.o |
| o o.=*+Oo.|
| . o*o=B+o+|
+----[SHA256]-----+
ssh는 키본키인 id_rsa가 아니라 신규로 생성한 키들을 선택하여 사용할 수 있는 옵션이 존재
[root@server1 ~]# ssh -i /root/.ssh/server2 root@server2
root@server2's password:
인증키에 비밀번호가 존재하는 경우 패스워드 입력과 동일하다.
[root@server1 ~]# ssh-copy-id -i /root/.ssh/server2.pub root@server2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/server2.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@server2'"
and check to make sure that only the key(s) you wanted were added.
[root@server1 ~]# ssh -i /root/.ssh/server2 root@server2
Enter passphrase for key '/root/.ssh/server2':
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Jan 15 14:48:24 2022 from 192.168.10.200
eval $(ssh-agent) : 인증키의 비밀번호를 메모리상에 암호화 시켜서 로드 시키기 위한 환경변수
ssh-add key : ssh-agent에 입력한 비밀번호를 키에 맵핑시켜 로드(암호화)
[root@server1 ~]# eval $(ssh-agent)
Agent pid 112822
[root@server1 ~]# ssh-add /root/.ssh/server2
Enter passphrase for /root/.ssh/server2:
Identity added: /root/.ssh/server2 (root@server1.example.com)
[root@server1 ~]# ssh -i /root/.ssh/server2 root@server2
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Jan 15 14:50:02 2022 from 192.168.10.200
[root@server2 ~]#
[root@server1 ~]# alias SERVER2='ssh -i /root/.ssh/server2 root@server2'
[root@server1 ~]# ssh -o StrictHostKeyChecking=no root@server2
Warning: Permanently added 'server2,192.168.10.252' (ECDSA) to the list of known hosts.
root@server2's password:
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Jan 15 14:56:50 2022 from 192.168.10.200
[root@server2 ~]#
[root@server1 .ssh]# ssh-keygen -f /root/.ssh/id_rsa -N '' -t rsa -b 4096
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dFv3SibadSURMbuqoy3ZvQDd/u1tCsN8InLUYmppdsI root@server1.example.com
The key's randomart image is:
+---[RSA 4096]----+
| =o |
| + |
| . . . + .|
| . o = . +.|
| S * + = o|
| . * B * o |
| Eo*.X o |
| +o*o+.* .o|
| .oo...o++|
+----[SHA256]-----+
[root@server1 .ssh]# ssh-copy-id -o StrictHostKeyChecking=no root@server2
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@server2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'root@server2'"
and check to make sure that only the key(s) you wanted were added.
[root@server1 .ssh]#
[root@server1 ~]# scp file server2:/tmp/file10
file 100% 300 31.2KB/s 00:00
[root@server2 tmp]# ll
total 4
-rw-r--r--. 1 root root 300 Jan 15 15:04 file10
drwx------. 3 root root 17 Jan 15 12:59 systemd-private-7d2047e239494d9fb766269c638990c7-bluetooth.service-yLvwPf
drwx------. 3 root root 17 Jan 15 12:59 systemd-private-7d2047e239494d9fb766269c638990c7-colord.service-bLKH4f
drwx------. 3 root root 17 Jan 15 12:59 systemd-private-7d2047e239494d9fb766269c638990c7-ModemManager.service-2q8MTi
drwx------. 3 root root 17 Jan 15 12:59 systemd-private-7d2047e239494d9fb766269c638990c7-rtkit-daemon.service-18Jhph
drwx------. 2 root root 6 Jan 15 12:59 vmware-root_948-2688554130
ssh 클라이언트 명령어만 잘 사용하면 편리하게 관리 할수 있다.
Bridged : 외부 네트워크 가능
NAT : 외부 네트워크 가능
사설IP -> 공인IP
공인 : 외부네트워크와 통신이 가능한 IP
사설 : 내부네트워크와 통신이 가능한 IP
HostOnly : 외부 네트워크 불가능
6교시 15:40 ~ 16:40>
NAT vmNet8 : Servive 형태 구성 / 가상의 게이트웨이역할을 해줘서 외부 네트워크와 연결
vmware nat : 내부망 통신을 하기 위하여 사용하는 기술
software switch
HostOnly : VM 끼리 통신 가능 / 외부 통신 불가
Bridged : host 컴퓨터가 존재하는 망에 연결하는 것 / 여러대 있는 경우에도 VM 끼리 연결 가능
가상 머신을 생성할 때 MAX 주소도 생성이 된다.
Bridged로 연결이 될때 다른 컴퓨터에서 같은 MAX 주소가 부여될 경우가 있다.
virtualbox network > Chapter 6. Virtual Networking - Oracle VM VirtualBox
7교시 16:50 ~ 17:50>
계정 관리 / account / 인증 / 인가
useradd의 옵션들은 계정을 생성하면서 바로 /etc/passwd 파일에 적용함.
[root@server1 ~]# cat /etc/passwd
team01:x:1000:1000:team01:/home/team01:/bin/bash
team01: 계정명
x: 패스워드가 /etc/shadow 파일에 있다.
1000: UID
1000: GID
team01: 계정에 대한 설명
/home/team01: 홈디렉토리 위치
/bin/bash: 로그인 할 때 사용하는 쉘
[root@server1 ~]# cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/usr/bin/tmux
/bin/tmux
[root@server1 ~]# yum -y install ksh
[root@server1 ~]# cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/usr/bin/tmux
/bin/tmux
/bin/ksh
/bin/rksh
/usr/bin/ksh
/usr/bin/rksh
filename- : 백업 파일
[root@server1 ~]# ls -l /etc/passw*
-rw-r--r--. 1 root root 2894 Jan 15 12:04 /etc/passwd
-rw-r--r--. 1 root root 2785 Jan 15 11:59 /etc/passwd-
[root@server1 ~]# ls -l /etc | grep [-]$
-rw-r--r--. 1 root root 1082 Jan 15 11:59 group-
----------. 1 root root 869 Jan 15 11:59 gshadow-
-rw-r--r--. 1 root root 2785 Jan 15 11:59 passwd-
----------. 1 root root 1653 Jan 15 11:59 shadow-
-rw-r--r--. 1 root root 40 Dec 18 16:12 subgid-
-rw-r--r--. 1 root root 40 Dec 18 16:12 subuid-
[root@server1 ~]#
8교시 18:00 ~ 18:30>
[root@server1 ~]# cat /etc/shadow
team01:$6$n2f7hVLMI2Iusi71$80vcOrYxqIRjKFwIYNVsIuVfLWc5KVy2rhUnlQRUQ0FJDGVeT15fnqUSLqBHEvhkhPpTb5d8z7bd3PGjZ7DQP1:19000:0:99999:7:::
team01 : 계정명
$6 : HASH 종류(1 MD5 / 2 Blowfish / 5 SHA-256 / 6 SHA-512
$n2f7hVLMI2Iusi71 : salt 값
$80vcOrYxqIRjKFwIYNVsIuVf... : 패스워드를 암호화 한 실제 값
:19000 : 마지막 패스워드 변경 날짜
:0 : 패스워드 최소 사용기간
:99999 : 패스워드 최대 사용 기간
:7 : 패스워드 만료 경고일
:: : 패스워드 만료 후 계정잠기는 비활성 날짜(빈칸)
:: : 패스워드 만료일(빈칸)
[root@server1 ~]# useradd team02
[root@server1 ~]# usermod -aG team01 team02
[root@server1 ~]# cat /etc/group | grep team01
team01:x:1000:team02
[root@server1 ~]# id team02
uid=1004(team02) gid=1004(team02) groups=1004(team02),1000(team01)
[root@server1 ~]#
skel : 새로운 사용자를 생성하였을 경우, 새 사용자를 위한 기본 폴더를 참고하는 디렉토리
[root@server1 ~]# cd /etc/skel
[root@server1 skel]# ls
[root@server1 skel]# ls -A
.bash_logout .bash_profile .bashrc .kshrc .mozilla
[root@server1 skel]# echo 'HI' > README
[root@server1 skel]# ls
README
[root@server1 skel]# useradd fedora1
[root@server1 skel]# cd /home/fedora1
[root@server1 fedora1]# ls
README
[root@server1 fedora1]# cat README
HI
[root@server1 fedora1]#
계정 잠그기 / 풀기
[root@server1 fedora1]# usermod -L team01
[root@server1 fedora1]# cat /etc/shadow | grep team01
team01:!$6$n2f7hVLMI2Iusi71$80vcOrYxqIRjKFwIYNVsIuVfLWc5KVy2rhUnlQRUQ0FJDGVeT15fnqUSLqBHEvhkhPpTb5d8z7bd3PGjZ7DQP1:19000:0:99999:7:::
[root@server1 fedora1]# usermod -U team01
[root@server1 fedora1]# cat /etc/shadow | grep team01
team01:$6$n2f7hVLMI2Iusi71$80vcOrYxqIRjKFwIYNVsIuVfLWc5KVy2rhUnlQRUQ0FJDGVeT15fnqUSLqBHEvhkhPpTb5d8z7bd3PGjZ7DQP1:19000:0:99999:7:::
[root@server1 fedora1]#
주그룹 / 부그룹(주그룹을 지정하지 않으면 계정명과 같은 이름의 그룹이 생성되어 주그룹이 됨)
useradd 계정명 -g 주그룹 -G 보조그룹1,보조그룹2
useradd 계정명 -G 보조그룹1,보조그룹2
[root@server1 fedora1]# find / -user team01 -or -group team01 > /dev/null | grep -v /home/team01 | grep -v /var/spool/mail/team01
find: ‘/proc/115800/task/115800/fd/7’: No such file or directory
find: ‘/proc/115800/task/115800/fdinfo/7’: No such file or directory
find: ‘/proc/115800/fd/8’: No such file or directory
find: ‘/proc/115800/fdinfo/8’: No such file or directory
[root@server1 fedora1]#
[root@server1 fedora1]# groupadd test10
[root@server1 fedora1]# useradd team100
[root@server1 fedora1]# id team100
uid=1006(team100) gid=1007(team100) groups=1007(team100)
[root@server1 fedora1]# groupdel test10
로컬계정 :
네트워크계정 :
LDAP :
mount
nmcli > nmtui
'CentOS > Study' 카테고리의 다른 글
[리눅스]01. 23 교육 정리 (0) | 2022.01.23 |
---|---|
[리눅스]01. 22 교육 정리 (0) | 2022.01.23 |
[리눅스]01. 08 교육 정리 (0) | 2022.01.08 |
[리눅스]12.18 교육 정리 2 (0) | 2021.12.19 |
[리눅스]12.18 교육 정리 1 (0) | 2021.12.19 |