On ServerB, schedule a cron job that prints "Break Time!" every two hours on weekdays on your current screen. Use the root user as the user performing the cron job.
answere)
crontab -e00 */2 * * 1-5 echo "Break Time!"
*/2: 매 2시간마다
1-5: weekdays
validation
crontab -lOn ServerB, change the user sam's login shell to Bash.
answere)
vi /etc/passwdsam:x:1001:1001::/home/sam:/bin/bash
validation
su - samecho $SHELLOn ServerB, write a script /sum.sh that prompts the user to enter two integers and then displays their sum.
answere)
cd /touch sum.shchmod +x sum.shvi /sum.sh#!/bin/bash
(( SUM=$1+$2 ))
echo "sum is: $SUM"
(( )): bash의 산술 계산 전용 구문
validation
./sum.sh 1 2Which of the following commands replaces each occurrence of 'sam' in the file letter with 'Sam' and writes the result to the file newletter?
answere)
sed s/sam/Sam/g letter > newletterman seds/regexp/replacement: regex에 해당하면, replacement로 교체g: globalvalidation
vi lettersam juwon test sam
sed 's/sam/Sam/g' ltter > newlettercat newletterWhich command is used to sync the hardware clock to the system clock? (Specify ONLY the command without any path or parameters.)
answere)
hwclockvalidation
hwclocktimedatectlOn ServerB, using disk /dev/sdb, complete the following tasks:
5T thin provisioned volume named mythinvol under a 2G thin pool called mythinpool within a 4G volume group named myvg.mythinpool by 1G.Rename the thin pool from mythinpool to thinpool1.Rename the thin provisioned volume from mythinvol to thinvol1.answere)
lsblkfdisk /dev/sdbnEnterEnterEnter+4Gt8ewlsblkcreate thinpool
pvcreate /dev/sdb1vgcreate myvg /dev/sdb1lvcreate -L 2G --thinpool mythinpool /dev/myvglvscreate thin provisioned volume
lvcreate -V 5T --name mythinvol /dev/myvg/mythinpool-V: Virtual sizelvsextend thinpool
lvextend -L +1G /dev/myvg/mythinpoollvsrename thin pool
lvrename /dev/myvg/mythinpool /dev/myvg/mythinpool1lvsrename thin provisioned volume
lvrename /dev/myvg/mythinvol /dev/myvg/mythinvol1lvsOn ServerB, configure autofs to automatically mount user directories from the remote NFS ServerA. The server exports the /nfs/home directory, which contains individual user directories (e.g., /nfs/home/tom).
Mount these user directories on demand under the local /nfs/users directory. Ensure the mount is accessible and persists across reboots.
answere)
ServerA - nfs server
dnf install -y nfs-utilssystemctl enable --now nfs-server rpcbindfirewall-cmd --list-allfirewall-cmd --add-service=nfs --permanentfirewall-cmd --add-service=rpc-bind --permanentfirewall-cmd --add-service=mountd --permanentfirewall-cmd --reloadfirewall-cmd --list-allmkdir -p /nfs/home/tomvi /etc/exports/nfs/home serverb(no_root_squash,rw,sync)
exportfs -arvshowmount -esystemctl restart nfs-serverServerB - nfs client, autofs
dnf install -y nfs-utilsshowmount -e serveramkdir -p /nfs/usersvi /etc/auto.master/nfs/users /etc/auto.nfs
vi /etc/auto.nfs* -fstype=nfs,rw,sync servera:/nfs/home/&
*: /nfs/users/*를 의미함.
&: 매칭되는 값을 그대로 대체한다는 것을 의미
systemctl restart autofsvalidation
cd /nfs/users/tomdf -ThWhich of the following commands overwrites the bootloader located on /dev/sda without overwriting the partition table or any data following it?
answere)
dd if=/dev/zero of=/dev/sda bs=440 count=1man ddOn ServerB, write a script named /find_rf.sh that prints out a list of files owned by root and with the SUID bit set in /usr.
answere)
cd /touch find_rf.shchmod +x find_rf.sh#!/bin/bash
find /usr -uid 0 -perm -4000
man find
-perm 4000: SetUID
-perm 2000: SetGID
-perm 1000: Sticky
./find_rf.shvalidation
cd /usrls -alConfigure the system so that when user sam creates files and directories, the following default permissions are applied:
answere)
vi /home/sam/.bash_profileumask=077
file은 원래 기본적으로 x권한이 빠진다.
validation
touch test1mkdir test2