RHCSA
RHCSA
Ans:
#nmtui (Set system host name & Edit a connection then Quit)
#systemctl restart NetworkManager
#systemctl reboot
Ans:
o Step1 - Add port in firewall – 82
#systemctl status httpd
#firewall-cmd --permanent --add-port=82/tcp (For adding port value)
#firewall-cmd --reload
#firewall-cmd --list-ports (To check port value)
3.Configure YUM repos with the given link (2 repos: 1st is BaseOS and 2nd
is AppStream)
Link: - http://content.example.com/rhel9.0/x86_64/dvd/AppStream
Link: - http://content.example.com/rhel9.0/x86_64/dvd/BaseOS
Ans :
#cd /etc/yum.repos.d (Default directory which stores all the repo files)
#vi file.repo (Need to create a repo file inside the yum.repos.d)
[BaseOS] (repo ID must be in [ ], Name it anything)
name=BaseOS
gpgcheck=0
enabled=1
baseurl=http://content.example.com/rhel9.0/x86_64/dvd/BaseOS
[AppStream]
name=AppStream
gpgcheck=0
enabled=1
baseurl=http://content.example.com/rhel9.0/x86_64/dvd/AppStream
:wq
# yum clean all
# yum repolist
#yum install autofs (For checking package working or not)
#cd (Come out from the directory)
Ans:
# groupadd sysadmin
# useradd saara
# useradd natasha
# gpasswd -M saara,natasha sysadmin (For add both the users inside the
group)
# useradd -s /sbin/nologin harry (if we use –s /sbin/nologin the user in
bash)
#echo avaster |passwd --stdin saara (Assigning password for user – (We
can use passwd but we cannot
see password what we type))
#echo avaster |passwd --stdin natasha
#echo avaster |passwd --stdin harry
Ans:
#mkdir -p /shared/sysadmin
6. The user saara must be configure a cron job that runs daily 5:30 PM
local time executes logger "EX200 in progress"
Or
Set the cron job for the user “saara” that should runs daily every 1
minute local time executes “Ex200 is progress”
with echo.
Ans :
#crontab -eu saara (it will open crontab editer tab related to saara)
30 17 * * * /usr/bin/logger "EX200 in progress" (Using “cat /etc/crontab”
command shows order of time & Date)
(For Full path of logger file use “which logger” command)
:wq (For checking use “crontab –lu saara” command)
Or
#crontab -eu saara
*/1 * * * * /usr/bin/echo "EX200 in progress" (For Full path of echo file
use “which echo” command)
:wq
8. Create a user deal with user id 2015 and assign the password Redhat.
Ans
#useradd -u 2015 deal (For adding user and user id we use -u after
useradd command)
(For checking id details use “id deal” command)
#echo Redhat |passwd --stdin deal
Ans
# vi /etc/chrony.conf
#put # in all the server and write
server classroom.example.com iburst
#systemctl enable chronyd
#systemctl restart chronyd.service (For checking use “chronyc sources”
command)
10.a. Search the files with extension .pl and copy the files to directory
/root/pl.found.
b. Search student user files and copy the files to directory
/root/student.found. (Most come this Question)
Ans:
# mkdir /root/pl.found
# find / -type f -name *.pl -exec cp {} /root/pl.found \; (here we are
copy files from root to root)
(or)
# mkdir /root/student.found
# find / -type f -user student -exec cp -rvfp {} /root/student.found \;
(Here we are copy from student to root
user so this case need to use –rvfp)
Ans:
# grep sa /usr/share/dict/words |sort > /root/sa.found
Ans.
a. #tar -czvf /root/etc.tar.gz /etc (For gzip we use ‘czvf’)(First
destination and then source)
b. #tar -cjvf /root/etc.tar.bz2 /etc (For bzip2 we use ‘cjvf’)
c. #tar -cJvf /root/etc.tar.xz /etc (For xz we use ‘cJvf’)
13. Configure autofs to automount the home directories of LDAP users.
Note the following:
Ans:
#yum install autofs
# systemctl start autofs
#systemctl enable autofs
#vi /etc/auto.master (‘Shift+g’ will go to end of the line)
#vi /etc/auto.misc
remoteuser1 -rw,sync classroom.example.com:/home/guests/remoteuser1
:wq
14. When we will create any users in servera the password of that
particular user should expire in 20days.
Ans:
#vi /etc/login.defs
PASS_MAX_DAYS 20
:wq (To check add one user and put “chage -l user” )
15. write a script named adhoc.sh under /root which will search less than
2M files from /var and store it in
/root/backup and also set the permission of set user identifier (SUID)
{OR} Make a Simple script - Create myscript file to locate all files of
10MB lower and also set the permission of set
group identifier (SGID) and list of all file will save in /root/script.
Copy script file into /usr/local/bin. Make sure run script any location.
Ans:
#vi adhoc.sh
#!/bin/bash
find /var -type f -size -2M -exec cp -v {} /root/backup \;
:wq!
#chmod +x adhoc.sh
#chmod u+s adhoc.sh
#./adhoc.sh
{OR}
Ans. #mkdir /root/script
#vi myscript
#!/bin/bash
find / -type f -size -10M -exec cp {} /root/script \;
:wq!
#chmod g+s /root/script
#chmod +x myscript
#./myscript
# cp myscript /usr/local/bin
{OR}
Ans: su - Pendora
vi .bash_profile
EX200="Welcome to Cyberphoton!!!"
echo $EX200
wq!
exit
su - Pendora [for checking]
Ans:
vi /etc/sudoers
%group1 ALL=(ALL) NOPASSWD:ALL
:wq!
17.When the existing user joe will create the file the permission should
come as rw------- and when create the
directory it should come as rwx------
Ans:
Ans:
#ssh alth@servera (if alth password won’t give in question try to put
same password as root)
#wget http://domain.exam.com/rhel9/Containerfile
#loginctl enable-linger alth
#podman build -t monitor . (After name we need to put space then dot)
#podman images
2.Configure YUM repos with the given link (2 repos: 1st is BaseOS and 2nd
is AppStream)
Link: - http://content.example.com/rhel9.0/x86_64/dvd/AppStream
Link: - http://content.example.com/rhel9.0/x86_64/dvd/BaseOS
Ans:
#cd /etc/yum.repos.d (Default directory which stores all the repo files)
#vi file.repo [the extension .repo is must]
[BaseOS] (repo ID must be in [ ], Name it anything)
name=BaseOS
gpgcheck=0
enabled=1
baseurl=http://content.example.com/rhel9.0/x86_64/dvd/BaseOS
[AppStream]
name=AppStream
gpgcheck=0
enabled=1
baseurl=http://content.example.com/rhel9.0/x86_64/dvd/AppStream
:wq
Ans:
#fdisk /dev/vdb (n for new partition, then primary, leave it primary
sector and last sector need to
add volume 30x8 = 240MB we need to add 100MB more then it will 340MB)
Last sector: +340M (Next change the partition type from Linux to
linuxlvm. t for partition type. Take
default partition code)
Hex code or alias (type L to list all): L (Type L and check hex code for
lvm and then enter that value)
Hex code or alias (type L to list all): 8E
w
#pvcreate /dev/vdb2
#vgcreate -s 8M redhat /dev/vdb2
#lvcreate -l 30 -n fedora redhat (small l)
#mkdir /mnt/fedora
#mkfs.ext4 /dev/redhat/fedora
#vi /etc/fstab (go to end and write bellow command)
/dev/redhat/fedora /mnt/fedora ext4 defaults 0 0
:wq
4.Resize the logical Volume named myvol to 100MB. (NOTE: Size in between
90MB to 110MB is acceptable)
Ans:
#lvdisplay |grep myvol (to get the lv path we use this command)
#lvresize -r -L 100M /dev/vg/myvol (For checking use “lvdisplay” command)
Ans:
#fdisk /dev/vdb
press n
enter-->enter-->type +512M enter
select t for giving type to swap id is=19
w
#partprobe
#mkswap /dev/vdb3
after completing swap partition update /etc/fstab
# vi /etc/fstab
/dev/vdb3 swap swap defaults 0 0
:wq
#swapon –a (#free -h [To check])
Ans:
# tuned-adm active (it will show active profile)
# tuned-adm recommend (it will show recommend profile)
# tuned-adm profile <give-recommended-profile-name-here> (To Check use
“tuned-adm active” command)