cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 1,254 Views

Red Hat Linux Interview Series 17

Q.) I have configured apache web service to serve the contents of the /home/student/public_html directory , allowing anyone with home directory permission to access its contents. However while accessing http://servera/~student/index.html  it gives http 403 forbidden error. How to resolve this ?

 

Q.) What is the utility of nsswitch.conf file ?

 

Q.) You have been provided a sar archive report - "report.data", how will you get the network statistics from this archive file ?

 

Bonus Q.) Please find the format of the network statistics :

Screenshot from 2024-10-10 01-21-37.png

How will you determine the highest number of network packets received per second for interface enp1s0, as recorded in the report.data file. 

 

Level - L2 and above.

 

I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.

19 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 719 Views

Let's have a look at that 2nd question:  What is the utility of nsswitch.conf file ?

Shame on me for picking this low-hanging fruit

The /etc/nsswitch. conf file is used to configure which services are to be used to determine information such as hostnames, password files, and group files.

The /etc/nsswitch. conf file defines the search order of the network databases.

I spend the great majority of my time in this file when I'm demonstrating hostname
resolution.  That line   -   hosts: dns, files   -  is where I hangout.  Of course, 
looking at the contents of /etc/nsswitch.conf, you'll see several other lines that are
functionally equivalent.

 

Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 713 Views

Question #3:  You have been provided a sar archive report - "report.data", how will you get the network statistics from this archive file ?

 

What I will do to retrieve the network statistics from the archive file, is to execute the following command:

sar  -n  ALL  -f  report.data

Note:  I'm assuming that I'm executing this command in the directory where the report.data file resides!!!  Otherwise, I've got to specify the
pathname to this filename.

Be forewarned, that using the keyword ALL in the above command can potentially produce a boat load of information.  There are other keywords
that can be used to narrow down the network statistics that can be
displayed.

A list of keywords that can be used in the sar command above, in place of the keyword ALL is shown below:

Keyword  --  Description

  • DEV – Displays network devices vital statistics for eth0, eth1, etc.,
  • EDEV – Display network device failure statistics
  • NFS – Displays NFS client activities
  • NFSD – Displays NFS server activities
  • SOCK – Displays sockets in use for IPv4
  • IP – Displays IPv4 network traffic
  • EIP – Displays IPv4 network errors
  • ICMP – Displays ICMPv4 network traffic
  • EICMP – Displays ICMPv4 network errors
  • TCP – Displays TCPv4 network traffic
  • ETCP – Displays TCPv4 network errors
  • UDP – Displays UDPv4 network traffic
  • SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6

See the sar man page for more information!

Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 712 Views

Regarding that Bonus question, "How will you determine the highest number of network packets received per second for interface enp1s0, as recorded in the report.data file.", here's my approach:

I'm going to key in on the "rkpck/s" column, which represents the received packets per second, for each network interface.  Looking at only the
values in that column, I'm then going to turn my attention to ONLY the lines
that report data for the enp1s0 interface.  From there, it's a simple matter
of putting my finger on the highest number - this represents the highest
number of network packets received per second for interface enp1s0.

 

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 677 Views

And if I say please give me the command good sir, what will be the command ?
Trevor
Starfighter Starfighter
Starfighter
  • 418 Views

I'm not ignoring the question Chetan.  My research is just not uncovering anything
on how to accomplish what "I'm understanding" in your question.  If this is
achievable by using a single command, then I might have to ask for you to expound
on your query.  Beginners like myself need a little boost every now and then!

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 389 Views

@Trevor well for that, it would be just a combination of sar command with grep, awk, sort and head to list the highest number of network packets received per second for interface enp1s0 as per the data fields.

So, this question is basically checking a lot of commands knowledge - kind of those Multiple returns on a single investment jackpot !

Trevor
Starfighter Starfighter
Starfighter
  • 383 Views

And so with that, you've essentially given me the answer - not because
of the commands that you mentioned, but because I now know that there
was/is no single command that can achieve what you were asking for.  
Using multiple tools, in a single command line, would have been too
simple

I can exhale now!!!!

Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 710 Views

That first question has the look of a "trick" question

The apache service is configured to serve content from the 
/home/student/public_html directory.  There is an attempt to access a file in
the login (aka home) directory of the student account.  If (big IF) the login
directory of the student account is truly setup properly to access content
in the public_html directory, then I have to lay the problem at the doorstep
of the index.html file!  I have to speculate that the file permissions on 
the index.html file are incorrect to allow access!!!

Now, this is my assessment, based on the assumption that the user did 
indeed mean to enter the URL http://servera/~student/index.html, and not
http://servera/~student/public_html/index.html.  If the user simply mistyped
the URL, then that's any easy (too easy) fix.  If the user has entered the
correct URL, then I have to stick with my assessment of file permission 
issues on the index.html file.

I have to believe that the permissions on the student login directory are okay because of the assumption in the question, that the apache server is
configured (assumed "properly" configured) to serve content from the
/home/student/public_html directory.  That implies that the necessary
permissions on the /home/student directory are configured to get into the
public_html directory.  As we know, it's impossible to get to public_html, if
we can't get through student.

 

 

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 677 Views

UseDir is all configured in the apache configuration and others access to the directory is also configured properly. Hint: think SELinux .

Join the discussion
You must log in to join this conversation.