본문 바로가기

ETC/자격증

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

반응형

1. 그룹인 ihdg 및 일반 사용자 계정인 ihd에 대한 관리 작업을 다음과 같이 실행하려고 한다. 

다음 ( 괄호 ) 안에 알맞은 명령어를 적으시오.

① 그룹 ihdg의 GID를 700번으로 생성하는 명령어를 완성하시오.
[root@ihd ~]# ( ① ) -g 700 ihdg

② ihd의 그룹 아이디를 800번으로 변경하는 명령어를 완성하시오.
[root@ihd ~]# ( ② ) -g 800 ihd

 

<groupadd>

- 그룹을 생성하는 명령어

[root@server1 /]# groupadd --help
Usage: groupadd [options] GROUP

Options:
  -f, --force                   exit successfully if the group already exists,
                                and cancel -g if the GID is already used
  -g, --gid GID                 use GID for the new group
  -h, --help                    display this help message and exit
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -o, --non-unique              allow to create groups with duplicate
                                (non-unique) GID
  -p, --password PASSWORD       use this encrypted password for the new group
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into

 

<usermod>

- 사용자의 정보를 수정

[root@server1 /]# usermod --help
Usage: usermod [options] LOGIN

Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                him/her from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

 

① groupmod

② usermod

 

2. A회사에서 운영하던 리눅스 시스템들은 백업을 로컬 DISK 에 용량을 할당하여 운영 중이다.

1년간 운영한 해당 시스템은 공간이 부족하여 새롭게 DISK를 증설하여 용량을 확보하여야 한다. 

다음과 같이 작업을 수행하는 경우 아래 조건을 참조하여 ( 괄호 ) 안에 알맞은 명령어를 적으시오.

 

<조 건>
- 기존 백업의 위치는 /backup2013 이다.
- 신규 백업의 위치는 /backup2014 이며, 새롭게 추가된 하드디스크 전체를 할당하여 사용하고자 한다.
- 추가된 하드디스크의 장치명은 /dev/sdc 이다.

- 명령어 또는 파일명은 절대경로를 포함하여 작성한다.

 

① ( ① ) /dev/sdc : 디스크 파티션을 만든다.

② ( ② ) /dev/sdc1 : 파티션을 ext4 파일시스템 으로 생성한다.

③ mkdir /backup2014 : 마운트 포인트를 생성한다.

④ mount -( ③ ) ext4 /dev/sdc1 /backup2014 : 
파티션(/dev/sdc1)을 /backup2014 디렉토리에 마운트한다.

 

파티션 생성 명령어 : fdisk

[root@server1 /]# fdisk -help
Usage:
 fdisk [options] <disk>    change partition table
 fdisk [options] -l <disk> list partition table(s)
 fdisk -s <partition>      give partition size(s) in blocks

Options:
 -b <size>             sector size (512, 1024, 2048 or 4096)
 -c[=<mode>]           compatible mode: 'dos' or 'nondos' (default)
 -h                    print this help text
 -u[=<unit>]           display units: 'cylinders' or 'sectors' (default)
 -v                    print program version
 -C <number>           specify the number of cylinders
 -H <number>           specify the number of heads
 -S <number>           specify the number of sectors per track

 

파일시스템 생성 : mkfs

[root@server1 /]# mkfs -help
Usage:
 mkfs [options] [-t <type>] [fs-options] <device> [<size>]

Options:
 -t, --type=<type>  filesystem type; when unspecified, ext2 is used
     fs-options     parameters for the real filesystem builder
     <device>       path to the device to be used
     <size>         number of blocks to be used on the device
 -V, --verbose      explain what is being done;
                      specifying -V more than once will cause a dry-run
 -V, --version      display version information and exit;
                      -V as --version must be the only option
 -h, --help         display this help text and exit

For more information see mkfs(8).

 

마운트 : monut

[root@server1 /]# mount -help

Usage:
 mount [-lhV]
 mount -a [options]
 mount [options] [--source] <source> | [--target] <directory>
 mount [options] <source> <directory>
 mount <operation> <mountpoint> [<target>]

Options:
 -a, --all               mount all filesystems mentioned in fstab
 -c, --no-canonicalize   don't canonicalize paths
 -f, --fake              dry run; skip the mount(2) syscall
 -F, --fork              fork off for each device (use with -a)
 -T, --fstab <path>      alternative file to /etc/fstab
 -h, --help              display this help text and exit
 -i, --internal-only     don't call the mount.<type> helpers
 -l, --show-labels       lists all mounts with LABELs
 -n, --no-mtab           don't write to /etc/mtab
 -o, --options <list>    comma-separated list of mount options
 -O, --test-opts <list>  limit the set of filesystems (use with -a)
 -r, --read-only         mount the filesystem read-only (same as -o ro)
 -t, --types <list>      limit the set of filesystem types
     --source <src>      explicitly specifies source (path, label, uuid)
     --target <target>   explicitly specifies mountpoint
 -v, --verbose           say what is being done
 -V, --version           display version information and exit
 -w, --rw, --read-write  mount the filesystem read-write (default)

 -h, --help     display this help and exit
 -V, --version  output version information and exit

Source:
 -L, --label <label>     synonym for LABEL=<label>
 -U, --uuid <uuid>       synonym for UUID=<uuid>
 LABEL=<label>           specifies device by filesystem label
 UUID=<uuid>             specifies device by filesystem UUID
 PARTLABEL=<label>       specifies device by partition label
 PARTUUID=<uuid>         specifies device by partition UUID
 <device>                specifies device by path
 <directory>             mountpoint for bind mounts (see --bind/rbind)
 <file>                  regular file for loopdev setup

Operations:
 -B, --bind              mount a subtree somewhere else (same as -o bind)
 -M, --move              move a subtree to some other place
 -R, --rbind             mount a subtree and all submounts somewhere else
 --make-shared           mark a subtree as shared
 --make-slave            mark a subtree as slave
 --make-private          mark a subtree as private
 --make-unbindable       mark a subtree as unbindable
 --make-rshared          recursively mark a whole subtree as shared
 --make-rslave           recursively mark a whole subtree as slave
 --make-rprivate         recursively mark a whole subtree as private
 --make-runbindable      recursively mark a whole subtree as unbindable

 

① fdisk

② mkfs -t ext4

③ t

 

3. 다음은 시스템의 프로세스 정보, 메모리 사용량, IO상태, CPU사용률 등의 정보를 출력한다.

해당 명령어를 이용하여 매일 23시 30분에 1초 단위로 10회씩 /var/log/check.log 파일로 누적되어 저장되도록 

명령어를 적으시오.

 

다음은 해당 명령어를 실행했을 때의 예시이다.
-----------------------------------------------------------------
procs---------memory-------- --swap-- --io-- -system- ---cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 109740 127888 239684 0 0 1 1 8 9 0 0 100 0 0
0 0 0 109616 127888 239684 0 0 0 0 78 144 0 0 100 0 0
-----------------------------------------------------------------
[root@ihd ~]# ( ① ) -e
----------------------------------------------------
30 23 * * * ( ② ) 1 10 ( ③ ) /var/log/check.log
----------------------------------------------------

 

주기적인 작업 예약 명령어 : crontab

[root@server1 /]# man crontab

 

프로세스, 메모리, 스왑, 입출력, 시스템, CPU 정보 출력 명령어 : vmstat

[root@server1 /]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 2675988   1076 354752    0    0    10     3   34   46  0  0 99  0  0

 

파일에 추가 리다이렉션 : >>

 

① crontab

② vmstat

③ >>

반응형