You are on page 1of 12

Amity Institute

Of Information
LINUX/UNIX QUESTION
Technology

BANK
Saket Kr.Pathak
Linux/Unix Question Bank

Q. No. 1. Architecture of Linux.


Answer:

The fundamental architecture of Unix/Linux is manned by 3 levels. The outer crust


resides the application programs and their utilities, at the heart, there is Unix kernel,
which interacts with actual hardware in machine language. The streamlining of these
2 modes of communication is done by middle layer, called the shell.

Application Tools

Shell

Kernel

Hardware

The shell, or the command interpreter as it is called, is the mediator, which


intermediate the commands we give and then conveys them to the kernel, which
ultimately executes them. The kernel has the various functions, as it manages files,
carries out all the data transfer between the file system and the hardware, and also
manages memories. The onus of scheduling of various programs running in the
memory or allocation of CPU time to all running programs also with kernel. The
kernel program is usually stored in a file called ‘unix’, whereas the shell program is in
‘sh’ file.

Q. No. 2. Printing in Linux.


Answer:
 The Printer Configuration Tool allows users to configure a printer in Linux.
 This tool helps maintain the printer configuration file, print spool directories,
and print filters.
 Linux defaults to the CUPS (Common Unix Printing System).
 To use the Printer Configuration Tool you must have root privileges. To start the
application, select Applications => System Settings => Printing

The following types of print queues can be configured:


 Locally-connected — a printer attached directly to the computer through a
parallel or USB port.
 Networked CUPS (IPP) — a printer that can be accessed over a TCP/IP network
via the Internet Printing Protocol, also known as IPP (for example, a printer
attached to another Red Hat Linux system running CUPS (Common Unix
Printing System) on the network).

Amity Institute Of Technology Page 2


Linux/Unix Question Bank

 Networked UNIX (LPD) — a printer attached to a different UNIX system that can
be accessed over a TCP/IP network (for example, a printer attached to another
Red Hat Linux system running LPD (Line Printer Daemon) on the network).
 Networked Windows (SMB) — a printer attached to a different system which is
sharing a printer over a SMB network (for example, a printer attached to a
Microsoft Windows™ machine).
 Networked Novell (NCP) — a printer attached to a different system which uses
Novell's NetWare network technology.
 Networked JetDirect — a printer connected directly to the network through HP
JetDirect instead of to a computer.

Q. No. 3. DNS.
Answer:
 DNS is a network service that enables clients to resolve names to IP address and
vice-versa.
 Allows machines to be logically grouped by domain names.
 Provides email routing information.
 A DNS server maintains the name to IP address mapping of the domain for which
it is the name server.
 The DNS server for a domain is registered with the domain registrar and the
entry is maintained by the Internet Root-Servers (13) or Country Level Root-
Servers.
 Whenever a server is queried, if doesn’t have the answer, the root servers are
contacted.
 The root servers refer to the DNS server for that domain (in case the domain is a
top level domain) or the Country Root Server (in case the domain is country level
domain).
Named daemon is used
 A DNS Server may be caching/master/slave server
 The named.ca file has information of all Root Servers.
 Configuration file:
/var/named/chroot/etc/named.conf

Q. No. 4. FTP Connection.


Answer:
FTP Connection Types & Transfer Programs:
 Secure Shell (SSH)
– Secure Copy (SCP) May be Used to Transfer Data Within an SSH
Connection to FTP01
 File Transfer Protocol (FTP) Based
– “ftp” Command Invoked Within an SSH Connection
– Native “ftp” Invoked From the Customer’s Desktop
– Native “ftp” Based Desktop Programs
 There Are a Number of These
 Typically add a Graphical User Interface (GUI)

Amity Institute Of Technology Page 3


Linux/Unix Question Bank

 May Also Provide File Transfer Interrupt / Resume Function


– Secure FTP (sftp)

 The File Transfer Protocol (FTP) is used as one of the most common means of
copying files between servers over the Internet.
 Most web based download sites use the built in FTP capabilities of web browsers
and therefore most server oriented operating systems usually include an FTP
server application as part of the software suite.
 Fedora linux ftp sever using default Very Secure FTP Daemon (VSFTPD) package
 FTP relies on a pair of TCP ports to get the job done. It operates in two
connection channels
o FTP Control Channel, TCP Port 21: All commands send and the ftp server's
responses to those commands will go over the control connection.
o FTP Data Channel, TCP Port 20: This port is used for all subsequent data
transfers between the client and server.
 With Fedora, Redhat, Ubunbtu and Debian You can start, stop, or restart
VSFTPD after booting by using these commands:
o [root@bigboy tmp]# /etc/init.d/vsftpd start
o [root@bigboy tmp]# /etc/init.d/vsftpd stop
o [root@bigboy tmp]# /etc/init.d/vsftpd restart

 With Redhat / Fedora you can configure VSFTPD to start at boot you can use the
chkconfig command.
o [root@bigboy tmp]# chkconfig vsftpd on

Q. No. 5. Shells(Korn, Bourne And C)


Answer: Page-201-202, Chapter-9 (Unix-Shell Scripting, Y.K. karnetkar)

Q. No. 6. Linux booting steps.

Answer:

Boot Steps:
1. BIOS/BOOT Monitor (System Start-Up)
2. Stage-1 (Boot Loader/ MBR)
3. Stage-2 (LILO/GRUB)
4. Linux (Kernel)
5. User-Space (Init)

The boot process of an Ubuntu system starts with the boot loader (typically GRUB)
which loads the kernel and an initial ramdisk (initramfs). The initramfs sets up the
console, usually including a splash screen, starts the udev daemon to process device
events from the kernel, finds and mounts the root filesystem, and chains to it,
mounting some important virtual filesystems along the way.

Amity Institute Of Technology Page 4


Linux/Unix Question Bank

Once the root filesystem is mounted, upstart takes over as PID 1, and begins to start
tasks specified in /etc/init/. While this will change in the future, at the moment these
tasks are essentially shims for System V init scripts and runlevels, defined in
/etc/rc*.d/. In the default configuration, upstart runs the contents of /etc/rcS.d/,
which sets up hardware and filesystems, and then runs the contents of /etc/rc2.d/,
which starts a variety of system services.

In a desktop installation, one of the services launched is an X display manager,


which presents a login screen. Otherwise, the user may log in on a virtual console
using one of the getty. instances started by upstart.

Q. No. 7. File Systems.


Answer: Page-61-64, Chapter-3 (Unix-Shell Scripting, Y.K. karnetkar)

Q. No. 8. RPM format.


Answer:

The most common format in which software packages are made available for SUSE
Linux is a package format called RPM, which originally stood for "RedHat Package
Manager". An rpm package consists of basically three parts: a header, a signature,
and the (generally compressed) archive itself . The header contains a complete file
list, a description of the package, a list of the features and libraries it provides, a list
of tools it requires (from other packages) in order to function. The basic rpm tool
needs information in the header to permit a package to be installed (or uninstalled!)
in such a way that:
 Installing the package breaks none of the already installed packages (recursively,
as they may need packages of their own to be installed).
 All the packages that the package requires for correct operation are also (or
already) installed along with the selected package, recursively.
 A later version of the package does not (accidentally) replace an earlier version of
the package.

The basic idea behind RPM is to have an "enhanced archive" of a compiled binary
files along with the necessary configuration files that can be unpacked on the system
with "one click" in working package installation and later upgraded to a new version
or de-installed without remembering all the places where the fie went.  An RPM
database of all available applications is installed on your computer (in /var/lib/rpm)
and this database is accessible by various tools including YaST. It helps to determine
exactly what is on your system, what might be new and updated, and what files each
package provides that another package might need to run properly.

An easy way to install RPMs along with associated dependencies is to use ‘YUM’
(Yellow dog Updater, Modified) or apt for RPM. Of the two products, I would
recommend using yum, as it has a smaller code base than apt for RPM, it is written
in python (similar to Red Hat's anaconda installer), and it makes upgrading to new

Amity Institute Of Technology Page 5


Linux/Unix Question Bank

Red Hat releases relatively easy (apt for RPM has a dist-upgrade feature, but I have
never tried it).

Q. No. 9. Mounting and un-mounting.


Answer:
Linux mount usb drive
To use thumb drive in Linux, the device must first be mounted into the system. In
older days, you must specify the file system type so Linux can mount it to he system.
Today, Linux is clever enough to recognise it and manually mounting the file system
is much easier. Here is what the mount command means:
 mount - The mount command serves to attach the file system found on some
device to the big file tree. Conversely, the umount(8) command will detach it
again.
 umount - The umount command detaches the file system(s) mentioned from
the file hierarchy. A file system is specified by giving the directory where it has
been mounted. Giving the special device on which the file system lives may
also work, but is obsolete, mainly because it will fail in case this device was
mounted on more than one directory.

Note that a file system cannot be unmounted when it is `busy' - for example, when
there are open files on it, or when some process has its working directory there, or
when a swap file on it is in use. The offending process could even be umount itself - it
opens libc, and libc in its turn may open for example locale files. A lazy unmount
avoids this problem.

Q. No. 10. What is NFS?


Answer:

Network File Service:


 Allows to share Directories between UNIX Systems
 Daemons: netfs, nfs, nfslock (also uses portmap and rpc service)

NFS Server Configuration:


 Exported File System(s) are defined in Configuration File /etc/exports
/data 172.31.0.0/16
/www abc.amity.edu

NFS Client Configuration:


 Configuration File : /etc/fstab
server1:/data /users/data nfs defaults 0 0
mount server1:/data /users/data
(Note: The mount point must exist before /etc/fstab is read or the filesystem is manually
mounted)

Q. No. 11. What is FTP? FTP client at server configuration.


Amity Institute Of Technology Page 6
Linux/Unix Question Bank

Answer:

Enable an FTP Server: Objectives


 The Role of an FTP Server
 How FTP Works
 Advantages of PureFTPd Server
 How to Configure PureFTPd Server

The Role of an FTP Server:


 Basic features:
o Sending, receiving, deleting, and renaming files
o Creating, deleting, and changing directories
o Transferring data in binary or ASCII mode
 Allows accesses after authentication against a password database
o These are the files /etc/passwd and /etc/shadow
o PureFTPd supports authentication against its own password database
o Guest access can be set up as anonymous FTP

How FTP Works:


 Uses two TCP connections
o One sends FTP command (port 21)
o Second connection is created when a file is ready for transfer
 Types of data transfer
o Active data transfer
 FTP client offers FTP server an unprivileged TCP port for data
channel connection (port 20)
o Passive data transfer
 FTP server offers FTP client an unprivileged TCP port for a data
channel connection

Advantages of PureFTPd Server:


 PureFTPd features:
o Consistent use of chroot environments
o Uncomplicated configuration of virtual FTP servers
o Virtual users independent of the system users listed in the file
/etc/passwd
o Configuration via command-line parameters or with a configuration file

How to Configure PureFTPd Server:


 How to configure anonymous FTP
o You need to have an FTP user and home directory in the file /etc/passwd
 You do not need to create any subdirectories
o You can also use command pure-ftp
o Files uploaded to the server belong to the user ftp
 How to configure FTP with virtual hosts for anonymous FTP

Amity Institute Of Technology Page 7


Linux/Unix Question Bank

o Virtual FTP hosts allow a number of FTP sites to be hosted on one


machine

Q. No. 12. VI editor.


Answer: Page-126,127,128, Chapter-6 (Unix-Shell Scripting, Y.K.
karnetkar)

Q. No. 13. Gnome and KDE desktop environments.


Answer:

Most comparisons of the KDE and GNOME desktops focus on usability and
productivity apps. However, they often neglect what might be called the leisure apps
-- specifically, those used for image and music management. But in the modern
online culture, these leisure apps are often as important to users as any other aspect
of the desktop. For many, especially at home, they are probably more important than
a word processor or spreadsheet. In KDE, photo management is generally handled
by DigiKam, and music by Amarok. In GNOME, F-Spot is used most often for
photos, while traditionally Rhythmbox has been used for music.

The focus for the large part of this guide has been with the GNOME Desktop.
However, there is another popular graphical desktop environment out there known
as the K Desktop Environment, affectionately known as KDE. It is included with
most systems, and has a strong user-base, just like the GNOME Desktop. KDE offers
an alternative desktop computing experience in that while the applications should all
function in the same manner irrespective of the desktop environment chosen, the
look and feel of the graphical desktop are different. Desktop-specific tools and
applets may also be different from one environment to the next.

Q. No. 14. Squid proxy server and configuration.


Answer:

A proxy is a host which relays web access requests from clients


 used when clients do not access the web directly
 used for security, logging, accounting and performance

web
Obtaining Squid:
 Source code (in C) from www.squid-cache.org
 Binary executables
Linux (comes with RedHat and others)
FreeBSD
Windows
 Pre-installed in Fedora/Enterprise Linux

Amity Institute Of Technology Page 8


Linux/Unix Question Bank

Basic Settings:
 Edit the /etc/squid/squid.conf file to configure squid
 Configuration options:
Disk Cache size and location
Authentication
Allowed Hosts
Any other access restrictions (sites, content, size, time of access etc.) using ACL
 service squid start/stop/restart

Squid.conf Configuration:
 cache_dir ufs /var/spool/squid/cache 100 16 256
 auth_param basic program /usr/lib/squid/ncsa_auth /etc/shadow
 users proxy_auth required
 http_access allow users
 acl our_network src 172.28.250.0/24
 http_access allow our_network
(Note: use squid –z for the first time to create the cache directory and its subdirectories)

Q. No. 15. What is shell? How is programming performed in C shell?


Answer: Page-201-202, Chapter-9 (Unix-Shell Scripting, Y.K. karnetkar)

Q. No. 16. What are shell variables and shell scripts?


Answer: Page-209, Chapter-9 (Unix-Shell Scripting, Y.K. karnetkar)

Q. No. 17. Apache web server and its runtime configuration.


Answer:

 Apache Web Server is used, Daemon is httpd (service httpd start/stop/restart)

Files used by Apache:


 Configuration file: /etc/httpd/conf/httpd.conf
 Log files: /var/log/httpd/access_log and /var/log/httpd/error_log
 Modules /etc/httpd/modules
 Default Document Root /var/www/html
 Default CGI Root /var/www/cgi-bin

Basic Settings:
 Change the default value for ServerName www.<your-domain.com> in
httpd.conf and put the website content in /var/www/html
 Additionally you can configure Name based Virtual Hosting (allow more than one
websites to run on the same server)

Virtual Hosting:
 NameVirtualHost *:80

Amity Institute Of Technology Page 9


Linux/Unix Question Bank

 <VirtualHost *:80>
ServerName server-name
DocumentRoot path-to-virtual-document-root
</VirtualHost>
 <VirtualHost *:80>
ServerName server-name
DocumentRoot path-to-virtual-document-root
</VirtualHost>

Q. No. 18. What is mail web server? MTA, MUA, MDA

Answer:

MUAs, MTAs, and MDAs


There are three main parts of the Unix E-mail system:

Part What It Does Examples


The MUA is the program which the user uses to
Mail User
read and send e-mail. It reads incoming messages elm, pine,
Agent
that have been delivered to the user's mailbox, and mutt
(MUA)
passes outgoing messages to an MTA for sending.
The MTA basicly acts as a "mail router". It accepts a
Mail message passed to it by either an MUA or another
Transfer MTA, decides based upon the message header sendmail,
Agent which delivery method it should use, and then postfix, qmail
(MTA) passes the message to the appropriate MDA for that
delivery method.
Mail
Delivery The MDA accepts a piece of mail from an MTA and mail.local,
Agent performs the actual delivery. procmail
(MDA)

The MTA is the most important one of these. It is responsible for doing all the
"intelligent" work of e-mail transfer. While it does not actually perform any of the
delivery itself, it is the part which tells the other parts how to interact and what to do.
In a sense, the MTA is the glue which holds the whole process together.

To illustrate how the three parts of the email system work together, here's a very
general example. This is what happens when the user jsmith@host1.uiuc.edu sends
e-mail to johndoe@host2.uiuc.edu:

Amity Institute Of Technology Page 10


Linux/Unix Question Bank

1. jsmith's MUA (pine, elm, etc) on host1.uiuc.edu passes the message to the
MTA (sendmail) on the local host.
2. The MTA (sendmail) notices that the message is addressed to a user at
host2.uiuc.edu. Since it is configured to know that it can reach host2.uiuc.edu
via SMTP, it passes the message to the SMTP MDA (the SMTP MDA is
actually builtin to sendmail, but all other MDAs are external programs).
3. The SMTP MDA connects to the MTA on host2.uiuc.edu (sendmail) and sends
it the message.
4. The MTA on host2.uiuc.edu (sendmail) notices that the message is addressed
to a user on the local host, so it passes the message to the local MDA.
5. The local MDA saves the message in user johndoe's mailbox.

The next time johndoe logs in to host2.uiuc.edu and runs his MUA, the message is
there waiting for him to read.

Q. No. 19. What is “Send Mail” configuration and operation?


Answer:

 Simple Mail Transfer Protocol (SMTP) is used to transfer mail between Mail Servers
over Internet
 Post Office Protocol (PoP) and Internet Message Access Protocol (IMAP) is used
between Client and Mail Server to retrieve mails
Daemon: sendmail
 Configuration File: /etc/mail/sendmail.mc
 Edit the following lines
 LOCAL_DOMAIN(`localhost.localdomain')dnl
 DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
 Run “make –C /etc/mail” command to compile sendmail.mc and generate
sendmail.cf file.
 Restart sendmail and watch for errors

Amity Institute Of Technology Page 11


Linux/Unix Question Bank

 PoP3 & IMAP Server can be started using dovecot server (service dovecot
restart).

Q. No. 20. What is “Fetch Mail” configuration and operation?


Answer:
Fetchmail
– Retrieves mail from a POP3 server
– Delivered back to Sendmail

Amity Institute Of Technology Page 12

You might also like