상세 컨텐츠

본문 제목

AWS 9일차 부서지기

카테고리 없음

by kiminaki 2021. 6. 29. 20:19

본문


11. Create a volume group, and set 8M as a extends. Divided a volume group containing 50 extends on volume group lv (lvshare), make it as ext4 file system, and mounted automatically under /mnt/data. And the size of the floating range should set between 380M and 400M. 이 부분 무시

 

 

 pvcreate /dev/sdb1 /dev/sdb2
 vgcreate -s 8M vg0 /dev/sdb1 /dev/sdb2
 lvcreate -l 50 -n lv0 vg0
 mkfs.xfs /dev/vg0/lv0
 mkdir /mnt/data
 

 

vi /etc/fstab

/dev/vg0/lv0    /mnt/data       xfs     defaults        0 0

 


 mount -a

 


12. Add admin group and set gid=600 -

 

groupadd -g 600 admin

 

 

13. Add users: user2, user3.
The Additional group of the two users: user2, user3 is the admin group Password: redhat

 

  132  useradd user2 -G admin
  133  useradd user3 -G admin
  134  passwd user2

redhat

redhat
  135  passwd user3

redhat

redhat



14. Configure a task: plan to run echo "file" command at 14:23 every day.

 

  138  crontab -e

23 14 * * * root /bin/echo "file"


  139  crontab -l
  140  systemctl restart crond

 

 

15. Copy /etc/fstab to /var/tmp name admin, the user1 could read, write and modify it, while user2 without any permission.

 


  105  cp /etc/fstab /var/tmp/admin
  107  getfacl /var/tmp/admin
  109  useradd user01
  110  useradd user02
  112  setfacl -m u:user01:rwx /var/tmp/admin 
  113  setfacl -m u:user02:--- /var/tmp/admin 
  115  getfacl /var/tmp/admin

 

 

 

16. Adjust the size of the Logical Volume.
Adjust the size of the vo Logical Volume, its file system size should be 290M. Make sure that the content of this system is complete.
Note: the partition size is rarely accurate to the same size as required, so in the range 270M to 320M is acceptable.

 

 

umount /mnt/data                                             현재 존재하는 논리볼륨을 언마운트해준다

lvreduce -r -L 290M /dev/vg0/lv0                            해당 논리불륨의 크기를 조절

mkfs.xfs /dev/vg0/lv0                                     다시 파일시스템 포맷

 

 

 

17. Configure /var/tmp/fstab Permission.
Copy the file /etc/fstab to /var/tmp/fstab. Configure var/tmp/fstab permissions as the following:
Owner of the file /var/tmp/fstab is Root, belongs to group root
File /var/tmp/fstab cannot be executed by any user
User natasha can read and write /var/tmp/fstab
User harry cannot read and write /var/tmp/fstab
All other users (present and future) can read var/tmp/fstab.

 

 

  151  cp /etc/fstab /var/tmp/fstab
  152  chown root.root /var/tmp/fstab
  153  chmod a-x /var/tmp/fstab
  154  useradd natasha
  155  setfacl /var/tmp/fstab -m u:natasha:rwx
  157  setfacl -m u:natasha:rw- /var/tmp/fstab
  158  useradd harry
  159  setfacl -m u:harry:--- /var/tmp/fstab
  160  usermod o+r /var/tmp/fstab
  161  ls -l /var/tmp/fstab

 

 

18. Create a Shared Directory.
Create a shared directory /home/admins, make it has the following characteristics:
/home/admins belongs to group adminuser
This directory can be read and written by members of group adminuser Any files created in /home/ admin, group automatically set as adminuser.
디렉터리 생성하고 소유그룹명 지정하고 권한설정

 

  103  mkdir /home/admins
  104  groupadd adminuser
  105  chown .adminuser /home/admins
  106  chmod g+rwx /home/admins
  107  chmod g+s /home/admins
  109  ls -ld /home/admins

 

 

 

 

 

 


19. Configure NTP service, Synchronize the server time, NTP server: classroom.example.com
ntp 설정 8번 문제와 같음 

 


yum -y install chrony 

vi /etc/chrony.conf
Add: server classroom.example.com

systemctl enable chronyd 
systemctl restart chronyd

 

20. Configure a user account.
Create a user iar uid is 3400. Password is redhat
유저 생성하고 uid 설정하기 

 

useradd -u 3400 iar
passwd iar