Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views8 pages

wt4 Aout

White test redhat

Uploaded by

Nebih Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

wt4 Aout

White test redhat

Uploaded by

Nebih Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

WT4-Aout 2022

Partie A : clientnode.example.com
1. Set multi-user target as your default target
systemctl set-default multi-user.target
2. Reboot the machine
3. For this session, change your target to graphical target
systemctl isolate graphical.target
4. Configure your Host Name, IP Address, Gateway and DNS.
IP Address : 172.24.40.40/24
Gateway : 172.24.40.1
DNS : 172.24.40.1
hostname : clientnode.example.com
nmtui
5. Create a directory under /home named teachers. Its respective group is the group teacher.
The group teacher could read and write, while other users are not allowed to access it. The
files created in /home/teachers should belong to the group teacher.
mkdir /home/teachers
groupadd teacher
chown :teacher /home/teachers/
chmod g=rw,o=- /home/teachers/
chmod g+s /home/teachers/

6. Find the rows that contain « strat » from file /usr/share/dict/words and write them to the
file/tmp/testfile
grep "strat" /usr/share/dict/words > /tmp/testfile
7. Create a user bob with the shell /bin/sh
useradd -s /bin/sh bob
8. Create a user tom. His home directory is /redhat/tom
useradd -d /redhat/tom tom
9. Rename user bob to maninder and change his UID to 5460
usermod -l maninder bob
usermod -u 5460 maninder
10. Set the Expire Date 2030-06-15, for the user account of maninder.
chage -E 2023-06-15 maninder

11. Create a group called pgroup with a group ID of 3000


groupadd -g 3000 pgroup
12. Modify tom user account's so the password expires after 20 days
chage -E $(date -d +20days +%Y-%m-%d) tom

13. All users passwords expire after 500 days.


vi /etc/login.defs
PASS_MAX_DAYS 500
14. All password should contain at least one capital letter and two digits.
vi /etc/security/pwquality.conf
dcredit = -2
ucredit = -1
15. Create a user named leonel on the two machines with uid 6003. His home directory on the
server is named /servernode/leonel. It will be mounted on /clientnode /leonel with autofs
when leonel connects.
#############Server##############
useradd -u 6003 -b /servernode/ leonel
systemctl enable --now nfs-server
firewall-cmd --add-service=nfs –permanent
vi /etc/exports
/servernode *(rw,no_root_squash)
exportfs -avr
############# Client######## »
useradd -M -u 6003 -d /clientnode/leonel leonel
dnf install autofs nfs-utils
systemctl enable --now autofs
systemctl enable --now nfs-server
firewall-cmd --add-service=mountd –permanent
firewall-cmd --add-service=mountd –permanent
firewall-cmd --add-service=rpc-bind –permanent
vi /etc/auto.master
/clientnode /etc/auto.misc
vi /etc/auto.misc
leonel -rw 192.168.88.146:/servernode/leonel
systemctl restart autofs
systemctl restart nfs-server

16. Configure repos BaseOS and AppStream


url of BaseOS = http://vault.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/

url AppStrem= http://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/

17. Add servernode.example.com to /etc/hosts


172.24.40.42 servernode.example.com

18. Configure this machine as a client NTP. The server is servernode.example.com


dnf install chrony
systemctl enable --now chronyd
firewall-cmd --add-service=ntp –permanent
vi /etc/chrony.conf
server servernode.example.com iburst
systemctl restart chronyd

19. Make necessary configurations so that httpd runs on port 82


dnf install httpd
vi /etc/httpd/conf/httpd.conf
Listen 80
systemctl restart httpd
firewall-cmd --add-port=82/tcp –permanent
semanage port -a -t http_port_t -p tcp 82

Partie B : servernode.example.com
1. Reset root Password to redhat

2. Configure Selinux from permissive to enforcing mode.


vi /etc/selinux/config
SELINUX=enforcing
3. Configure your Host Name, IP Address, Gateway and DNS.
IP Address : 172.24.40.42/24
Gateway : 172.24.40.1
DNS : 172.24.40.1
hostname : servernode.example.com
nmtui
4. Create the Directory "/home/manager" with the following characteristics. Group ownership
of "/home/manager" should go to "manager" group. Root and all members of "manager"
group have full permission on the directory "/home/manager" . Others dont have any
permission on the directory. Files created under "/home/manager" should get the same
group ownership is set to the "manager" group.
mkdir /home/manager
groupadd manager
chown :manager /home/manager/
chmod 2770 /home/manager/

5. Create the user gabriel with uid 4223 with password "redhat".
useradd -u 4223 gabriel
passwd gabriel
6. All files that will be created by gabriel should have permissions rw- -r-- --- and all directories
should have permissions -rwxr-x --- . Then create two files named file1, file2 and two
directories named dir1 and dir2
vi /home/gabriel/.bash_profile
umask 027

7. locate the files of owner "gabriel" and copy them to /root/result


find / -type f -user gabriel -exec cp -a {} /root/result \;

8. Find all files of user root root and where setuid is configured and copy them to /root/output.
find / -type f -user root -perm -4000 -exec cp -a {} /root/output \;
9. Compress /root/output with bzip2
tar -cvjf compression.tar.bz2 /root/output/
10. List all lines which have string « ip » from "/usr/share/dict/words" file and copy the lines in
/root/found.
11. grep "ip" /usr/share/dict/words > /root/found
12. Add a swap partition with a size of 512MB and mount it permanently.
mkswap /dev/sda1
vi /etc/fstab
UUID=92999d87-4260-4139-b384-93af1e246d36 none swap defaults 00
Swapon -a
13. Create a logical Volume and mount it permanently.
 Create the logical volume with the name "lv" by using 5PE's from the volume group "vg".
 Consider each PE size of the volume group as "32 MB".
 Mount it on /mnt/lv with file system ext4.
14. Resize the logical volume "lv" so that after reboot the size should be in between 225M
and 275M.
15. Create a logical Volume and mount it permanently.
 Create the logical volume with the name "vol" by using 100PE's from the volume group
"grp".
 Consider each PE size of the volume group as "8 MB".
 Mount it on /vol with file system vfat.
lvcreate -l 100 -n vol vg
mkfs.vfat /dev/vg/vol
/dev/vg/vol /vol vfat defaults 0 0
mount -a

16. Create a new VDO partition using the following requirements:


 Use un unpartitioned disk
 Vdo name "thin" and logical size should be 50GB
 Mount it on /thin permanently with file system xfs.
17. Set recomended profile as your tuned profile
dnf install tuned
tuned-adm recommend
tuned-adm profile virtual-guest
systemctl restart tuned
18. Create a user thomas. Login as thomas. Then, connect to registry.ccess.redhat..com
with your username and password
dnf install podman
useradd thomas
ssh thomas@localhost
podman login registry.access.redhat.com

19. Configure your host journal to store all journal across reboot
vi /etc/systemd/journald.conf
Storage=persistent
systemctl restart systemd-journald
20. Create a container with a name logserver from an image rsyslog and configure
automount /var/log/journal from logserver (container) to /home/fabrice/container_logserver
when container starts.
21. Configure the container to start as a systemd service by an existing user “thomas” and
to start automatically across reboot.
22. Set the recomended profile as your tuned profile

You might also like