Saturday 31 January 2015

9. Sample Test

9. Sample Test

 
Note : Please go through the parent posts 1-8 to know about this test. 
 

Q1. Create users Natasha, Harry and Sarah. Natasha and Harry should be member of secondary group admin and Sarah should not be the member. Sarah should have no interactive shell and password of all users are wakennym.

Q2. Create /common/adm. Group owner should be admin. Only admin group should have read write execute permission. Natasha and Harry should connect to /common/adm. Any file under /common/adm should have group admin.

Q3. Copy /etc/fstab to /var/tmp/fstab. Owner and group should be root. Natasha should be allowed to read and write and no one should be allowed to execute. And all others should be able to read the files. Harry should not be allowed to read or write.

Q4. Create the partition having 500 MB size and mount it in /mnt/backup.

Q5. Resize lvm from 100 MB to 300 MB

Q6. Configure swap of 700 MB

================================================================================
ANSWERS
Ans 1:  
    groupadd admin
    useradd -G admin Natasha
    passwd Natasha
    useradd -G admin Harry
    passwd Harry
    useradd -s /sbin/nologin Sarah

Ans 2:
mkdir -p /common/adm chgrp -R admin /common chmod -R 2070 /common

Ans 3:
cp -rvf /etc/fstab /var/tmp/fstab setfacl -m u:Natasha:rw /var/tmp/fstab setfacl -m u:Harry:000 /var/tmp/fstab setfacl -m u:Sarah:r /var/tmp/fstab
Ans 4: fdisk /dev/sda n 7 default +500M w mkfs -t ext4 /dev/sda7 mkdir /mnt/backup mount /dev/sda7 /mnt/backup
Ans 5: fdisk /dev/sda n 8 default +500M t 8 8e w pvcreate /dev/sda8 vgcreate VG1 /dev/sda8 lvcreate -n LV1 -l 25 VG1 mkfs.ext4 /dev/sda8 lvextend -L +200M /dev/VG1/LV1 resize2fs -p /dev/VG1/LV1
Ans 6: fdisk /dev/sda n 9 default +700M t 9 82 w mkswap /dev/sda9 swapon /dev/sda9

For any help;
noohppnoohpp@gmail.com