본문 바로가기

ETC/자격증

[리눅스마스터]제1601회 리눅스마스터 1급 2차 시험 단답식 풀이 3

반응형

7. 다음 ( 괄호 ) 안에 알맞은 내용을 적으시오.

가. 사용자 접속시 성공한 로그를 기록하는 파일은 ( ① )이고, 이 파일은 바이너리 파일로서 ( ② )
라는 명령어로 확인할 수 있다.

나. 사용자 접속시 실패한 로그를 기록하는 파일은 ( ③ )이고, 이 파일은 바이너리 파일로서 ( ④ )
라는 명령어로 확인할 수 있다.

<조 건>
- 로그 파일명은 절대 경로로 표기하고, 명령어는 실행 명령어만 기입한다.

 

로그명 내용 로그경로 명령어 비고
utmp 현재 로그인한 사용자의 정보 /var/run/utmp finger,w,who 명령어로 확인
wtmp 성공한 로그인/로그아웃
시스템 booting/shutdown 정보
/var/log/wtmp last, last -F 명령어로 확인
lastlog 마지막으로 성공한 로그인 기록 /var/log/lastlog lastlog, finger lastlog -u [계정명]
lastlog -t [일수]
btmp 실패한 로그인 시도에 대한 기록 /var/log/btmp lastb, last -f btmp 명령어로 확인
acct/pacct 사용자가 입력한 명령어, 터미널 종류, 프로세스 시작시간 등을 기록   lastcomm 명령어로 확인
secure 사용자/그룹 생성, 삭제, 로그인 등 사용자 인증에 대한 정보 기록 /var/log/secure   원격 접속 기록, su 명령어 수행 내역, xinetd 인증 기록
message 시스템 운영에 대한 전반적인 메시지 기록 /var/log/message   tcpwrapper, snort 등의 수행 내역 기록
dmesg 리눅스가 부팅될 때 출력되는 메시지 기록 /var/log/dmesg dmesg 텍스트 파일
boot.log 리눅스가 부팅될 때 파일시스템, 서비스 데몬 체크한 정보 기록 /var/log/boot.log    
Xferlog FTP 로그 파일 /var/log/xferlog   FTP 사용한 내용을 상세하게 기록

 

[root@server1 ~]# last
root     pts/0        192.168.10.1     Fri Mar 25 12:03   still logged in
(unknown :0           :0               Fri Mar 25 12:03   still logged in
reboot   system boot  3.10.0-123.el7.x Fri Mar 25 12:02 - 12:06  (00:04)
root     pts/0        192.168.10.1     Fri Mar 25 07:48 - 08:17  (00:29)
(unknown :0           :0               Fri Mar 25 07:47 - crash  (04:14)
reboot   system boot  3.10.0-123.el7.x Fri Mar 25 07:47 - 12:06  (04:19)
root     pts/0        192.168.10.1     Thu Mar 24 19:39 - down   (01:03)
(unknown :0           :0               Thu Mar 24 19:38 - down   (01:04)
reboot   system boot  3.10.0-123.el7.x Thu Mar 24 19:37 - 20:43  (01:05)
root     pts/0        192.168.10.1     Thu Mar 24 12:07 - 12:29  (00:22)
(unknown :0           :0               Thu Mar 24 12:06 - crash  (07:31)
reboot   system boot  3.10.0-123.el7.x Thu Mar 24 12:06 - 20:43  (08:36)
root     pts/0        192.168.10.1     Thu Mar 24 08:06 - down   (00:19)
(unknown :0           :0               Thu Mar 24 08:05 - down   (00:20)
reboot   system boot  3.10.0-123.el7.x Thu Mar 24 08:05 - 08:25  (00:20)
root     pts/0        192.168.10.1     Wed Mar 23 19:49 - 20:49  (01:00)
(unknown :0           :0               Wed Mar 23 19:48 - crash  (12:17)
reboot   system boot  3.10.0-123.el7.x Wed Mar 23 19:47 - 08:25  (12:38)
root     pts/0        192.168.10.1     Wed Mar 23 11:59 - down   (00:28)
(unknown :0           :0               Wed Mar 23 11:59 - down   (00:29)
reboot   system boot  3.10.0-123.el7.x Wed Mar 23 11:58 - 12:28  (00:29)
root     pts/0        192.168.10.1     Wed Mar 23 08:03 - 08:35  (00:32)
(unknown :0           :0               Wed Mar 23 08:02 - crash  (03:56)
reboot   system boot  3.10.0-123.el7.x Wed Mar 23 08:02 - 12:28  (04:25)
root     pts/0        192.168.10.1     Tue Mar 22 19:57 - 20:48  (00:50)
(unknown :0           :0               Tue Mar 22 19:56 - 20:48  (00:51)
reboot   system boot  3.10.0-123.el7.x Tue Mar 22 19:56 - 12:28  (16:31)
root     pts/0        192.168.10.1     Tue Mar 22 11:59 - down   (00:31)
(unknown :0           :0               Tue Mar 22 11:59 - down   (00:31)
reboot   system boot  3.10.0-123.el7.x Tue Mar 22 11:58 - 12:30  (00:31)
root     pts/0        192.168.10.1     Mon Mar 21 10:18 - down   (10:41)
(unknown :0           :0               Mon Mar 21 10:18 - down   (10:41)
reboot   system boot  3.10.0-123.el7.x Mon Mar 21 10:18 - 21:00  (10:41)
root     pts/0        192.168.10.1     Sun Mar 20 11:07 - 20:27  (09:20)
(unknown :0           :0               Sun Mar 20 11:04 - crash  (23:13)
reboot   system boot  3.10.0-123.el7.x Sun Mar 20 11:04 - 21:00 (1+09:55)
root     pts/0        192.168.10.1     Sat Mar 19 10:20 - down   (09:13)
(unknown :0           :0               Sat Mar 19 10:19 - down   (09:14)
reboot   system boot  3.10.0-123.el7.x Sat Mar 19 10:18 - 19:33  (09:14)
root     pts/0        192.168.10.1     Fri Mar 18 11:17 - down   (08:45)
(unknown :0           :0               Fri Mar 18 11:17 - down   (08:45)
reboot   system boot  3.10.0-123.el7.x Fri Mar 18 11:16 - 20:02  (08:46)
root     pts/0        192.168.10.1     Thu Mar 17 15:28 - 21:18  (05:50)
(unknown :0           :0               Thu Mar 17 15:27 - crash  (19:49)
reboot   system boot  3.10.0-123.el7.x Thu Mar 17 15:27 - 20:02 (1+04:35)
(unknown :0           :0               Thu Mar 17 15:26 - crash  (00:00)
root     pts/0        192.168.10.1     Thu Mar 17 09:35 - crash  (05:51)
(unknown :0           :0               Thu Mar 17 09:34 - 15:26  (05:51)
reboot   system boot  3.10.0-123.el7.x Thu Mar 17 09:34 - 20:02 (1+10:28)
root     pts/0        192.168.10.1     Wed Mar 16 11:21 - down   (07:59)
(unknown :0           :0               Wed Mar 16 11:20 - down   (08:00)
reboot   system boot  3.10.0-123.el7.x Wed Mar 16 11:20 - 19:20  (08:00)
root     pts/0        192.168.10.1     Mon Mar 14 12:07 - down   (05:58)
(unknown :0           :0               Mon Mar 14 12:04 - 18:05  (06:01)
reboot   system boot  3.10.0-123.el7.x Mon Mar 14 12:04 - 18:05  (06:01)
root     pts/1        192.168.10.1     Mon Mar 14 12:03 - down   (00:00)
root     pts/0        :0               Mon Mar 14 12:02 - 12:03  (00:00)
root     :0           :0               Mon Mar 14 12:01 - 12:03  (00:01)
(unknown :0           :0               Mon Mar 14 12:01 - 12:01  (00:00)
reboot   system boot  3.10.0-123.el7.x Mon Mar 14 21:00 - 12:03  (-8:-57)

wtmp begins Mon Mar 14 21:00:27 2022

 

[root@server1 ~]# lastb
root     ssh:notty    192.168.10.1     Wed Mar 16 11:21 - 11:21  (00:00)
root     ssh:notty    192.168.10.1     Wed Mar 16 11:20 - 11:20  (00:00)

btmp begins Wed Mar 16 11:20:56 2022

 

① /var/wtmp

② last

③ /var/log/btmp

④ lastb

 

8. 다음은 시스템 로그 파일에 대한 로테이션 (rotation) 정책을 설정하는 과정이다. 

아래의 조건을 참조하여 ( 괄호 ) 안에 알맞은 내용을 적으시오.

# vi ( ① )
( ② )
( ③ )
( ④ )

<조 건>
- ① : 관련 파일명을 절대 경로로 적는다.
- ② : 로테이션 주기는 한 달 단위로 설정한다.
- ③ : 로그 파일명에 해당 날짜를 덧붙여서 생성하도록 한다.
- ④ : 로테이션은 최대 5번으로 설정한다.

 

logrotate.conf : logrotate 실행의 모든 설정 파일

 

[root@server1 ~]# find / -name logrotate.conf
/etc/logrotate.conf

 

[root@server1 ~]# vi /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.

 

① /etc/logrotate.conf

② monthly

③ dateext

④ rotate 5

 

9. 다음은 /var/log/secure 파일의 속성을 확인하고 설정하는 과정이다. 

아래의 조건을 참조하여 ( 괄호 ) 안에 알맞은 내용을 적으시오.

# ( ① ) /var/log/secure
-------------e- /var/log/secure
# ( ② ) ( ③ ) /var/log/secure
# ( ① ) /var/log/secure
-----a-------e- /var/log/secure

<조 건>
- 각각의 ( 괄호 )에는 명령어, 옵션 또는 인자값(argument)을 한 개씩만 적도록 한다.
- 해당파일이 수정은 불가능하고 내용 추가만 가능하도록 설정한다.

 

secure 사용자/그룹 생성, 삭제, 로그인 등 사용자 인증에 대한 정보 기록 /var/log/secure   원격 접속 기록, su 명령어 수행 내역, xinetd 인증 기록

 

lsattr : 파일 속성 확인

chattr : 파일 속성 변경

a : 파일을 추가만 가능

c : 자동으로 압축되어 있는 상태로 저장

d : dump 명령을 통하여 백업받을 경우 백업받지 않음

i :  파일을 read-only로만 열 수 있게 설정합니다. 변경 / 삭제 등을 할 수 없음

s : 파일 삭제가 될 경우에 디스크 동기화가 일어나는 효과가 발생

S : 파일이 변경 될 경우에 디스크 동기화가 일어나는 효과가 발생

u : 파일이 삭제가 되엇을 경우에는 그 내용이 저장이 되며 데이터 복구가 가능

 

[root@server1 ~]# man lsattr
DESCRIPTION
       lsattr  lists  the file attributes on a second extended file system.  See chattr(1) for a description of
       the attributes and what they mean.

 

[root@server1 ~]# man chattr
DESCRIPTION
       chattr changes the file attributes on a Linux file system.

       The format of a symbolic mode is +-=[acdeijstuACDST].

       The operator `+' causes the selected attributes to be added to the existing attributes of the files; `-'
       causes them to be removed; and `=' causes them to be the only attributes that the files have.

       The letters `acdeijstuACDST' select the new attributes for the files: append only (a),  compressed  (c),
       no  dump (d), extent format (e), immutable (i), data journalling (j), secure deletion (s), no tail-merg‐
       ing (t), undeletable (u), no atime updates (A), no copy on write (C), synchronous directory updates (D),
       synchronous updates (S), and top of directory hierarchy (T).

       The  following attributes are read-only, and may be listed by lsattr(1) but not modified by chattr: huge
       file (h), compression error (E), indexed directory (I), compression raw access (X), and compressed dirty
       file (Z).

 

① lsattr

② chattr

③ +a

 

10. 다음은 디스크 파티션 단위로 백업하는 과정이다. ( 괄호 ) 안에 알맞은 내용을 적으시오.

# ( ① ) ( ② )=/dev/sdb1 ( ③ )=/dev/sda1 ( ④ )=1024

<조 건>
- 백업하려는 대상장치는 /dev/sda1이고, /dev/sdb1에 보관한다.
- 한 번에 입출력하는 블록 사이즈 단위는 1024byte이다.

 

dd : 디스크 파티션 단위로 백업 / 디스크 마이그레이션(Migration)하는 명령어

of : 지정한 파일을 출력대상으로 설정

if : 지정한 파일을 입력대상으로 설정

bs : 한번에 읽고 쓸 최대 바이트 크기 지정

 

[root@server1 ~]# dd --help
Usage: dd [OPERAND]...
  or:  dd OPTION
Copy a file, converting and formatting according to the operands.

  bs=BYTES        read and write up to BYTES bytes at a time
  cbs=BYTES       convert BYTES bytes at a time
  conv=CONVS      convert the file as per the comma separated symbol list
  count=N         copy only N input blocks
  ibs=BYTES       read up to BYTES bytes at a time (default: 512)
  if=FILE         read from FILE instead of stdin
  iflag=FLAGS     read as per the comma separated symbol list
  obs=BYTES       write BYTES bytes at a time (default: 512)
  of=FILE         write to FILE instead of stdout
  oflag=FLAGS     write as per the comma separated symbol list
  seek=N          skip N obs-sized blocks at start of output
  skip=N          skip N ibs-sized blocks at start of input
  status=WHICH    WHICH info to suppress outputting to stderr;
                  'noxfer' suppresses transfer stats, 'none' suppresses all

 

① dd

② of

③ if

④ bs

 

반응형