Part 2 (on Node2 Server)
Task 5 [Managing Logical Volumes]
Add an additional swap partition of 656 MiB to your system. The swap partition should automatically mount when your system boots
Do not remove or otherwise alter any existing swap partition on your system
*
[root@node2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdc 252:32 0 5G 0 disk
vdc1 252:33 0 4.1G 0 part
datavg-datalv 253:3 0 3.9G 0 lvm /data
vdd 252:48 0 5G 0 disk
vde 252:64 0 10G 0 disk
[root@node2 ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 1548 -2
[root@node2 ~]# free -m
total used free shared buff/cache available
Mem: 1816 1078 104 13 633 573
Swap: 2047 1 2046
[root@node2 ~]# parted /dev/vdc print
Number Start End Size Type File system Flags
1 1049kB 4404MB 4403MB primary lvm
*
[root@node2 ~]# parted /dev/vdc mkpart primary linux-swap 4404MiB 5060MiB
[root@node2 ~]# mkswap /dev/vdc2
Setting up swapspace version 1, size = 656 MiB (687861760 bytes)
no label, UUID=9faf818f-f070-4416-82b2-21a41988a9a7
[root@node2 ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 1804 -2
[root@node2 ~]# swapon /dev/vdc2
*
[root@node2 ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 1804 -2
/dev/vdc2 partition 671740 0 -3
[root@node2 ~]# blkid
/dev/vdc2: UUID='9faf818f-f070-4416-82b2-21a41988a9a7' TYPE='swap' PARTUUID='0f22a35f-02'
[root@node2 ~]# vim /etc/fstab
UUID=9faf818f-f070-4416-82b2-21a41988a9a7 swap swap defaults 0 0
[root@node2 ~]# reboot
[root@node2 ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 1804 -2
/dev/vdc2 partition 671740 0 -3
Create a collaborative directory/home/admins with the following characteristics:
Group ownership of /home/admins is adminuser
The directory should be readable, writable, and accessible to members of adminuser, but not to any other user. (It is understood that root has access to all files and directories on the system.)
Files created in /home/admins automatically have group ownership set to the adminuser group
mkdir /home/admins
chgrp -R adminuser /home/admins
chmodg+w /home/admins
chmodg+s /home/admins
Set cronjob for user natasha to do /bin/echo hiya at 14:23.
# crontab -e -u natasha
23 14 * * * /bin/echo hiya
wq!
Configure the permissions of /var/tmp/fstab
Copy the file /etc/fstab to /var/tmp/fstab. Configure the permissions of /var/tmp/fstab so that:
the file /var/tmp/fstab is owned by the root user.
the file /var/tmp/fstab belongs to the group root.
the file /var/tmp/fstab should not be executable by anyone.
the user natasha is able to read and write /var/tmp/fstab.
the user harry can neither write nor read /var/tmp/fstab.
all other users (current or future) have the ability to read /var/tmp/fstab.
cp -a /etc/fstab /var/tmp
cd /var/tmp
ls -l
getfacl /var/tmp/fstab
chmod ugo-x /var/tmp/fstab
[ No need to do this, there won't be execute permission for the file by default]
# setfacl -m u:natasha:rw /var/tmp/fstab # setfacl -m u:harry:0 /var/tmp/fstab(zero)
[Read permission will be there for all the users, by default. Check it using ls -l /var/tmp/fstab] Verify by
[ ls -la /var/tmp/fstab]
Create the following users, groups, and group memberships:
A group named adminuser.
A user natasha who belongs to adminuser as a secondary group A user harry who also belongs to adminuser as a secondary group.
A user sarah who does not have access to an interactive shell on the system, and who is not a member of adminuser, natasha, harry, and sarah should all have the password of redhat.
groupadd sysmgrs
useradd -G sysmgrs Natasha
We can verify the newly created user by cat /etc/passwd)
# useradd -G sysmgrs harry
# useradd -s /sbin/nologin sarrh
# passwd Natasha
# passwd harry
# passwd sarrah