Interview Questions on Linux Servers with Answers

How can you create a password less connection between multiple Linux machine?

  • To create a password less authentication we need to use RSA or DSA key authentication.
  • RSA and DSA are used as an algorithm for public-key encryption
  • RSA keys have minimum key length of 768 bits and the default length is 2048 bit.The key length of DSA is limited to 1024 bit so one can generate stronger RSA keys than DSA keys.
  • Create a pair of public and private key with a blank password when prompted.
  • Copy the public key to the remote client to which you want to login without password
  • Save the public key inside ~/.ssh/authorized_keys file
  • Everytime you copy the key to this file, the key is appended in the file.
  • Now try to login

For more details on the commands used and description follow the below link

How to create a password less authentication for ssh in Linux?

What are the types of authentication which can be used for ssh connection to any host?

You can create a password less connection between two Linux box using RSA authentication. 
RSA and DSA are used as an algorithm for public-key encryption

RSA and DSA keys are used for password authentication and providing much higher security for data transfer or connectivity between two remote machines.
  • RSA keys have minimum key length of 768 bits and the default length is 2048 bit.The key length of DSA is limited to 1024 bit so one can generate stronger RSA keys than DSA keys.
  • DSA encryption is faster as compared to RSA.
  • RSA can be used for both encryption and signing whereas DSA can only be used for signing.
  • RSA can be used with ssh v1 and v2 whereas DSA can only be used with v2

What is the difference between A record and CNAME record in DNS?
A record

  • It is the Address records also known as host records
  • Points to the IP address reflecting the domain
  • Used for forward lookup of any domain name

For example:
Our website is configured on 50.63.202.15 IP so the A record of my domain name will point towards that IP.

Every time a query for golinuxhub.com is made the internet will lookup for contents stored on the machine with 50.63.202.15 this IP.


CNAME Record

  • It is short abbreviation for Canonical Name
  • Provides an alias name for same hostname
  • Helps create subdomains

NOTE: You can not create a CNAME record for the domain name itself (it should be done with A record)

For example:
golinuxhub.com is a domain name whereas www.golinuxhub.com is a sub domain name


How will you restrict anonymous users from accessing your ftp server?
Change this value inside vsftpd.conf
anonymous_enable=NO
How does a dns lookup query works when you type a url on browser?

  • When you type a URL on the browser below are the course of actions performed
  • Browser cache is checked
  • Local hosts file is looked up for any records placed inside etc folder
  • URL query works right to left i.e for www.golinuxhub.com, .com is queried first and then the query moves from right to left.
  • The request then goes to ISP, if any earlier request for the same website was made then they will bring up the page from the stored cache
  • Next the query goes to root servers which will provide you the address of the Top Level Domain
  • The TLD will provide the location of nameserver, so next the ISP contacts nameserver for proper record
  • Once the ISP gets the record information it locally stores the information for further queries and throws the output on your browser.
  • Next time the query is made for the same page the ISP won't go through all these steps and bring out the page as per the cache stored from last query till the TTL value for that record is expired.
For more detailed information follow the below link
What happens in the backend when you type a url on the browser?

What is the command to check quota values for any user?
# repquota /partion/path | grep username
How many types of virtual hosting are their in apache?
There are 3 types of virtual hosting in Apache

  • Port based 
  • Hostname based 
  • IP based 

What are the port nos for DNS, DHCP, SMTP, POP3 and IMAP(with and without SSL)
DNS 53
DHCP 67
SMTP with ssl 465, 567
SMTP without SSL 25
POP3 with SSL 995
POP3 without ssl 110
IMAP with SSL 943
IMAP without SSL 143

What is the default port for ssh? How will you change it to some other random port no.?
SSH port no. by default is 22

To change the default port no. we need make required changes inside sshd_conf file in the below mentioned line
#Port 22 (Uncomment the above line and define the new port no.)

Restart the services for changes to take affect

Which command do you use to download a file from ftp or http website using CLI?
# wget path_to_the_file
How to disable root login via ssh?
Uncomment the below line inside sshd_config to "NO"
#PermitRootLogin yes
What if I have made a host entry in hosts.allow as well as hosts.deny file of my localhost. So will that remote host will be allowed to connect with my localhost machine? Explain

  • Yes, The host will be allowed to connect because their is a specific order which is followed before allowing or blocking any host/service.
  • Access will be granted when a (daemon,client) pair matches an entry in the /etc/hosts.allow file.
  • Otherwise, access will be denied when a (daemon,client) pair matches an entry in the /etc/hosts.deny file. Otherwise, access will be granted.

How do you limit maximum connections in your apache server?
Change the below parameter value inside httpd.conf
MaxClients 256