Professional Documents
Culture Documents
RHCSA7 LAB124. Solution
RHCSA7 LAB124. Solution
RHCSA7 LAB124. Solution
Sol ution
-
I n t h i s l a b , you w i l l practice a n d d e m o n st rate your k n o w l e d g e a n d s k i l ls.
Outcomes:
-
C o m p l ete t h e fo l l ow i n g tasks and s u ccessf u l l y g ra d e the serverX system wi th lab sal - r eview
g r ad e as user root on serverX.
-
Before you begin ...
Reset t h e serverX m a c h i ne.
-
Run t h e lab sal - r eview s e t u p a s u s e r root o n s e rverX.
[student@serverX
-
! - ] $ head - n 12 / u s r / bin/clean - binary - files >/home/ s t u d e n t /
! headt ail . txt
1.2. D i s p l ay t h e l a st n i n e l i nes of the / u s r /bin/clean - binary - files file and add the
I [student@serverX
co m m a n d output to the /home / s t u d e n t /head t ail . t x t f i l e .
-
• C reate the em pty f i l e s with the f i l e name sys t em_c h an g e s - mac h in eY - mon t h_Z . txt
i n the / home / s t u d e n t d i rectory o n the se rve r X m a c h i n e a s user st u d e n t . R e p l a c e Y w i t h
t h e m a c h i n e n u m be r a n d re p l ace z with t h e m o n t h s jan, feb, a n d mar.
[student@serverx
-
Solution
-
-
[ student@serverx -]$ mv an . /home/ s t udent/
[student@serverX -]$
syschanges/j an/
j'
mv -student/system_changes - machin e * feb . txt /home/ st ud e nt /
-
[student@serverX -]$ l
syschanges/feb/
mv - s t u d e n t / system_change s - mac hine *mar . txt /home/student/
syschanges/mar/
1
-
-
3. Use the man pages to research how to t u r n off t h e use of c o l o rs in the output. Put the
re l eva nt opt i o n of the ls co m m a n d i nto the text f i l e / home/ s t u d e n t /lscolo r . t x t on
serverX.
-
3.1 . Look u p t h e re l eva nt o pt i o n i n the ls(1) m a n page to dete r m i n e how to p reve nt I s from
p rovi d i n g co l o rfu l output. W h a t i s the correct option?
-
-
ls uses - - colo r =neve r to t u r n off co l o rs i n t h e c o m m a n d o u t p ut.
3.2. C reate t h e text file /home / s t u d e n t /lscolo r . txt with the ls option to turn off
c o l o rfu l output.
-
[ student@serverx -]$ cp /home/student/vimfile . txt /home / s t udent /longlistin g . t x t
- R H 1 24- R H E L 7 - e n -1 -20140606 41 3
-
U s e the a r row keys to pos i t i o n the c u rsor at a ny c h a racter on the Docume n t s row.
E n t e r v i s u a l m o d e with a n u p p e rcase v. T h e fu l l l i n e is s e l ected, a s s h o w n i n t h e screen
s h ot. D e l ete t h e s e l ection w i t h x. Repeat for t h e Pic t u re s row.
-
4.5. S a ve t h e f i l e a n d exit the editor.
Create t h ree new users : go rwell, r br a d b u ry, a n d dadams, with a pa sswo rd of f i r s t pw.
-
•
days.
[student@serverx - ] $
[ student@serverx - ] $
sudo vim /etc/login . defs
. . . Output omitted . . .
cat /etc/login . defs -
PASS_MAX_DAYS 60
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7
-
. . . Output omitted . . .
-
-
-
S o l ut i o n
-
[student@serverX -]$
[student@serverX -]$
sudo g roupadd - g 30000 i n s t r uc t o r s
stapdev : x : 158 :
t ail - 5 /etc/group
pesign : x : 989 :
-
tcpdump : x : 72 :
slocate : x : 21 :
instructors : x : 30000 :
-
slocate : x : 21 :
instructors : x : 30000 : gorwell, rbradbury, dadams
gorwell : x : 1001 :
rbradbury : x : 1002 :
-
dadams : x : 1003 :
[student@serverX -]$ sudo pas swd go rwell
Changing password for user gorwell .
-
New password : fi r s t pw
BAD PASSWORD : The password is shorter than 8 characters
Retype new password : firstpw
passwd : all authentication tokens updated successfully .
-
5.5. C h a n g e t h e pa ssword p o l icy for t h e go rwell acco u nt to req u i re a new password every
- 1 0 days.
-
J Number of days of warning before password expires 7
I [ student@serverX -]$
5.6. Fo rce a l l t h re e n e w l y c reated users to c h a n g e t h e i r pa ssword on f i rst l o g i n .
-
- R H 1 24- R H E L7-en-1-20140606 41 5
-
[student@serverX
·
[student@serverX
- ] $ sudo c h a g e - d a r b radb u r y
- ] $ sudo chage - d a dadams
-]$ su - -
[ root@serverx
redhat
-]#
-
�
users h a v e r e a d p e r m i s s i o n ( 4 ) to t h e d i recto ry.
[ root@serverX - ] # ls - ld /home/ins t r u c t o r s
drwxrwsr- - . 2 root instructors 1024 Dec 9 1 : 38 /home/instructors
7. Dete r m i n e t h e process u s i n g t h e m ost C P U resou rces o n s e rverX a n d t e r m i nate it.
[ root@serverX - ] # top
top 12 : 47 : 46 up 2 : 02, 3 users, load average : 1 . 67, 1 . 25, 0 . 73
Tasks : 361 total, 6 running, 355 sleeping, 0 stopped, 0 zombie
-
41 6 R H 1 24- R H E L7 - e n -1-20140606 -
-
-
Solution
Press q to q u it.
-
7.3. Te r m i n ate t h e c p u hog process u s i n g the com m a n d l i ne. Confirm t h at t h e p rocesses no
I [ root@serverx -]#
l o n g e r d i s p l ay i n top.
-
pkill cpuhog
-
8. Stop the c u r re n t l y r u n n i n g cups p r i n t i n g s e rvice o n serverX. The s e rvice s h o u l d not get
a utomatica l l y sta rted on syste m boot.
[ student@serverX -]$
[student@serverx -]$
sudo systemc t l stop cups
- sudo syst emc t l s t a t u s c u p s
-
8.2. Confi g u re t h e c u p s service so that it does n ot sta rt a t system boot.
I [student@serverX -]$
[student@serverx -]$
sudo syst emc t l disable c u p s
-
sudo s y s t e m c t l s t a t u s cups
9.2. I n sta l l the SSH p u b l i c key g e n e rated p reviou s l y o n se rverX to the s t u d e n t acco u n t on
d e s ktopX.
-
Now try logging into the machine, with : "ssh ' student@desktopX ' "
-
and check to make sure that only the key ( s ) you wanted were added .
-
-
-
C h a pter 1 6. C o m p re h e n s i ve Review
-
9.3. Log in, then c h a n g e to the root a ccou nt, o n the s e rverX v i rt u a l m a c h i n e.
[student@desktopX -]$
-
su -
-
9.4. C u s t o m i z e t h e s s h service o n s e rverX by d i s a b l i n g S S H c o n n e c t i o n s for t h e u s e r root
a n d o n l y a l low key-based l o g i n .
PermitRootLogin no
PasswordAuthentication no -
Password : redhat
Permission denied, please try again .
Password : redhat
Permission denied ( publickey, gssapi- keyex, gssapi-with -mic, password ) .
-
-
1 0. Yo u r serverX m a c h i n e h a s been rel ocated to t h e B a h a mas. T h e fo l l o w i n g c h a n g e s h ave to be
m a d e o n the serverX m a c h i n e :
-
• C h a n g e t h e t i m e zone on t h e serverX m a c h i n e to B a h a m a s a n d ve r i fy t h e t i m e z o n e has
been c h a n g e d prope r l y.
-
1 0.1 . I d e ntify t h e correct t i m e z o n e for B a h a m a s on serverX.
1} Africa
2 } Americas
3} Antarctica
-
4) Arctic Ocean
5 ) Asia
6 } Atlantic ocean
7 ) Australia
-
8 } Europe
9 ) Indian Ocean
10} Pacific Ocean
11} none - I want to specify the time zone using the Posix TZ format .
-
-
41 8 R H 1 24- R H E L7-en-1-20140606
-
-
Sol ution
3 ) Argentina 30 ) Jamaica
-
4 ) Aruba 31 ) Martinique
5 ) Bahamas 32 ) Mexico
-
6 ) Barbados 33 ) Montserrat
7 ) Belize 34 ) Nicaragua
8 ) Bolivia 35 ) Panama
9 ) Brazil 36 ) Paraguay
10 ) Canada 37 ) Peru
-
#? 1
You can make this change permanent for yourself by appending the line
TZ= ' America/Nassau ' ; export TZ
-
to the file ' . profile ' in your home directory; then log out and log in again .
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts :
-
America/Nassau
-
[ root@serverX -]#
-
t imedatec t l set - timezone America/Nassau
[ root@serverX -]#
Local time : Wed 2014-04-09 18 : 21 : 06 GEST
t imedatec t l
RTC in local TZ : no
-
-
-
Next DST change : DST ends ( the clock j umps one hour backwards ) at
Sun 2014-10-26 02 : 59 : 59 CEST
I Sun 2014-10-26 02 : 00 : 00 CET -
[ root@serverX -]#
I
echo " j ou rnalctl - - since 9 : 05 : 00 - - u n t il 9 : 15 : 00 " >/home / s t udent/ -
systemdreview . txt
j [ root@serverx -]#
-
-
1 2 .3. M o n itor t h e n e w l y created l o g f i l e /va r/log/au t h - e r r o r s on serverX for c h a n g es i n
a d iffe re nt t e r m i n a l w i n dow.
[ root@serverX -]#
-
t ail -f /var/log/au t h - e r r o r s
I [ root@serverx -]# logger - p authp riv . ale r t " Logging t e s t au t hp riv . ale r t "
-
I [ root@serverX -]#
log/au t h - e r r o r s .
-
13. C reate a new stat i c n etwork c o n n ection using t h e sett i n g s i n the fo l l owi n g table. B e s u re to
re p l a c e t h e X w i t h the c o r rect n u m be r for yo u r systems.
-
420 RH 124- R H E L 7-en-1-20140606
-
-
Solution
-
-
• other c o n n e ct i o n s s h o u l d not start a utomat ica l l y.
-
• S e t t h e host n a m e t o s e rverX.exa m p l e.com.
Pa ra m eter Sett i n g
- Connection name review
IP a d d ress 172 .25.X.11 /24
�
re p l a ce the X w i t h the correct n u m be r for yo u r syste ms.
· ·-1
'r �·root@serverX
-
�
.
L
- ] # nmcli con a d d con - n me e t h EI pe ethernet ip4
[ root@serverx
. 172 . 25 . X . 11/24 gw4 172 . 2 5 . X . 254
- 1 - ] # nmcli con mod 11 review11 ipv4 . d n s 172 . 25 . 254 . 254
-- --- - ��-
[ root@se rve rx
- � - - -�-
--
[ root@serverX
:
1
- ] # nmcli con mod " review" conne c t ion . a u t oconnect yes
-
I - ]# nmcli con mod " System e t h EI " conne c t ion . autoconnect no
i
L_
i [ root@serverx
- 13.3. M o d ify t h e new connect i o n so that it a l so uses t h e a d d ress 1 0.0.X.1 /24.
Or a l ternate l y :
-
[ root@serverX - ] # e c h o " I PADDR1=10 . El . X . 1 " >> /etc/sysconfig/netwo r k - sc ripts/
[ root@serverx
ifcfg - review
- ] # echo " PREFIX1=24" » /etc/sysconfig/netwo r k - sc ripts/ifcf g
- review
1 3.4. Config u re t h e hos t s f i l e so t h a t 1 0.0.X.1 can be refe re nced as " myhost " .
-
-
j [ root@serverx - ] # host namec t l set - hostname serverX . example . com
-
-
-
[student@serverX -]$
Password : redhat
su
[ root@desktopX -]#
14.2 . C reate t h e ta rget d i rectory f o r t h e confi g u ra t i o n f i l es o n serverX. -
[ root@serverX -]#
I
mkdir /configbac kup
-
[ root@desktopX - ] #
Password : redhat
-
s s h root@serverX
[ root@serverx -]#
-
-
-
S o l ut i o n
-
I
!
[ root@serverX configcompare]# t a r xzf /root /config - bac k u p - serve r . t a r . gz
-
• U s e s s h to execute t h e host name com m a n d o n d e s ktopX a s u ser st u de nt. S e n d t h e
o u t p u t o f t h e h o s t name c o m m a n d to t h e / t m p / s c pfile . t x t f i l e on d e s ktopX.
/home / s t u d e n t / sc pfile . tx t .
-
I [ root@serverx - ] # s s h s t udent@desktopX ' ho s t name >/tmp/scpfile . txt '
[ root@serverX
I
- ] # scp root@desktopX : /tmp/sc pfile . t xt /home/student/
-
18. C reate t h e file / e t c /yum . repos . d/local u pdat es . repo to e n a b l e t h e " U pdates"
- re pository fo u n d o n t h e content m a c h i ne. I t s h o u l d a ccess content fo u n d a t the fo l l ow i n g
U R L: http://conte nt.exa m p l e.com/rhel7.0/x 86_64/e r rata. Do not c h e c k GPG s i g n a t u res.
-
C reate the f i l e / e t c /yum . repos . d/localupdat es . repo with the fo l l ow i n g content:
gpgcheck=0
-
-
• The kernel package s h o u l d b e updated to t h e l atest vers i o n .
-
• Fo r secu rity rea sons, s e rverX should not h a ve t h e wvd ial package i n sta l l e d .
-
-
-
1 9.3. I n sta l l the r h t - sys t em pa ck ag e.
[ root@serverx - ] # blkid
/dev/vdal : UUID="46f543fd-78c9-4526- a857- 244811be2d88" TYPE="xfs"
-
[ root@serverX - ] # m k d i r /mnt/datadump
-
m a c h i n e.
[ root@serverX - ] # moun t UUID= " a84f6842 - ec ld - 4f6d - b767 - b9570f9fcdc0 " /mnt / -
datadump
-
22. C reate the soft l i n k / root /mydat aspace, w h i c h p o i n t s to the /mn t /datadump d i rectory
o n serverX.
, [ root@serverx
-
- ] # ln -s /mn t/datadump / root /mydatas pace
t h e /home/ s t u d e n t /find . t x t f i l e.
[root@serverx - ] # echo " find I - type 1 - name ' * d a t a * ' " >/home/ student/find . tx t
-
-
424 RH124- R H E L7 - e n -1-20140606