You are on page 1of 13

NAGARAJA

Q:1 How To check the uptime of a Linux Server ?

Ans: Using uptime command we can determine how long a linux box has been running , also uptime can be viewed
by the top & w command.

Q:2 How to check which Redhat version is installed on Server ?

Ans: Use the command cat /etc/redhat-release , output of this command will tell you the redhat version.

Q:3 How to install rpm packages in Redhat & CentOS linux ?

Ans: rpm and yum command are used to install packages in redhat linux and CentOS.

Q:4 How to check the ip address of LAN Card ?

Ans: Using 'ifconfig' & 'ip address' command we can determine the ip address of LAN Card.

Q:5 How to determine the hostname of a linux box ?

Ans: On typing the hostname command on terminal we can determine the hostname of a linux server.

Q:6 How To check the default gatway ?

Ans: Using 'rount -n' command we can determine the default gateway in linux.

Q:7 Which Command is used to check the kernel Version ?

Ans: 'uname -r'

Q:8 How to check the current runlevel of a linux box ?

Ans : 'who -r' and 'runlevel' , both of these command are used to find current run level.

Q:9 What is Initrd ?

Ans: Initrd stands for initial ram disk , which contains the temporary root filesystem and neccessary modules
which helps in mounting the real root filesystem in read mode only.

Q:10 What is Bootloader ?

Ans: Bootloader is a program that boots the operating system and decides from which kernel OS will boot.

Q:11 How to list hidden files from the command line ?

Ans: 'ls -a' <Folder_Name>

Q:12 What is soft link ?

Ans: Soft link is a method to create short cuts in linux. It is similar to windows short cut feature.

Q:13 How to create a blank file in linux from command line ?

Ans: Using the command 'touch <file-name>'


Q;14 What is run level 2 ?

Ans: Run level 2 is the multi-user mode without networking.

Q:15 Why linux is called OpenSource ?

Ans: Becuase One can customize the existing code and can redistribute it.

Q:16 How to check all the installed Kernel modules ?

Ans: Using the Command 'lsmod' we can see the installed kernel modules.

Q:17 What is the default uid & gid of root user ?

Ans: Default uid & gid of root user is 0.

Q:18 How To change the password of user from the Command Line ?

Ans: 'passwd <User-Name>'

Q:19 What is a Process ?

Ans: Any program in execution is called a process.

Q:20 What is name of first process in linux ?

Ans: 'init' is the first process in linux which is started by kernel and whose pid is 1.

Q:21 Why is LVM is required ?

Ans: LVM stands for Logical Volume Manager , to resize filesystems size online we required LVM partition in
Linux. Size of LVM partition can be extended and reduced using the lvextend & lvreduce commands respectively.

Q:22 How To check Memory stats and CPU stats ?

Ans: Using free & vmstat command we can display the physical and virtual memory statistics
respectively.With the help of sar command we see the CPU utilization & other stats.

Q:23 What does Sar provides and at which location Sar logs are stored ?

Ans: Sar Collect, report, or save system activity information. The default version of the sar command (CPU
utilization report) might be one of the first facilities the user runs to begin system activity investigation, because
it monitors major system resources. If CPU utilization is near 100 percent (user + nice + system), the workload
sampled is CPU-bound.

By default log files of Sar command is located at /var/log/sa/sadd file, where the dd parameter indicates the
current day.

Q:24 How to increase the size of LVM partition ?

Ans: Below are the Logical Steps :

- Use the lvextend command (lvextend -L +100M /dev/<Name of the LVM Partition> , in this example we are
extending the size by 100MB.

- resize2fs /dev/<Name of the LVM Partition>

- check the size of partition using df -h command

Q:25 How to reduce or shrink the size of LVM partition ?

Ans: Below are the logical Steps to reduce size of LVM partition :

-Umount the filesystem using umount command,

-use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G

-Now use the lvreduce command , e.g lvreduce -L 10G /dev/mapper/myvg-mylv

Above Command will shrink the size & will make the filesystem size 10GB.

Q:26 How to create partition from the raw disk ?

Ans: Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the
raw dsik :

- fdisk /dev/hd* (IDE) or /dev/sd* (SCSI)

- Type n to create a new partition

- After creating partition , type w command to write the changes to the partition table.

Q:27 Where the kernel modules are located ?

Ans: The /lib/modules/kernel-version/ directory stores all kernel modules or compiled drivers in Linux operating
system. Also with lsmod command we can see all the installed kernel modules.

Q:28 What is umask ?

Ans: umask stands for User file creation mask, which determines the settings of a mask that controls which file
permissions are set for files and directories when they are created.

Q:29 How to set the umask permanently for a user?

Ans: To set this value permanently for a user, it has to be put in the appropriate profile file which depends on the
default shell of the user.
Q:30 How to change the default run level in linux ?

Ans: To change the run level we have to edit the file /etc/inittab and change initdefault entry ( id:5:initdefault:).
Using init command we change the run level temporary like init 3 , this command will move the system in
runlevl 3.

Q:31 How to share a directory using nfs ?

Ans: To share a directory using nfs , first edit the configuration file /etc/exportfs , add a entry like

/<directory-name> <ip or Network>(Options) and then restart the nfs service.

Q:32 How to check and mount nfs share ?

Ans: Using showmount command we can see what directories are shared via nfs e.g showmount -e <ip address of
nfs server>.Using mount command we can mount the nfs share on linux machine.

Q:33 What are the default ports used for SMTP,DNS,FTP,DHCP,SSH and squid ?

Ans: Service Port

SMTP 25

DNS 53

FTP 20 (data transfer) , 21 ( Connection established)

DHCP 67/UDP(dhcp server) , 68/UDP(dhcp client)

SSH 22

Squid 3128

Q:34 What is Network Bonding ?

Ans: Network bonding is the aggregation of multiple Lan cards into a single bonded interface to provide fault
tolerance and high performance. Network bonding is also known as NIC Teaming.

Q:35 What are the different modes of Network bonding in Linux ?

Ans: Below are list of modes used in Network Bonding :

balance-rr or 0 round-robin mode for fault tolerance and load balancing.

active-backup or 1 Sets active-backup mode for fault tolerance.

balance-xor or 2 Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.

broadcast or 3 Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces.

802.3ad or 4 Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the
same speed & duplex settings.

balance-tlb or 5 - Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing.

balance-alb or 6 - Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.
Q:36 How to check and verify the status the bond interface.

Ans: Using the command cat /proc/net/bonding/bond0 , we can check which mode is enabled and what lan cards
are used in this bond. In this example we have one only one bond interface but we can have multiple bond interface
like bond1,bond2 and so on.

Q:37 How to check default route and routing table ?

Ans: Using the Commands netstat -nr and route -n we can see the default route and routing tables.

Q:38 How to check which ports are listening in my Linux Server ?

Asn: Use the Command netstat listen and lsof -i

Q:39 List the services that are enabled at a particular run level in linux server ?

Ans: With the help of command chkconfig list | grep 5:on we can list all the service that are enabled in run
level5. For other run levels just replace 5 with the respective run level.

Q:40 How to enable a service at a particular run level ?

Ans: We can enable a service using the Command chkconfig <Service-Name> on level 3

Q:41 How to upgrade Kernel in Linux ?

Ans: We should never upgrade Linux Kernel , always install the new New kernel using rpm command because
upgrading a kenel can make your linux box in a unbootable state.

Q:42 How To scan newly asssigned luns on linux box without rebooting ?

Ans: There are two ways to scan newly assigned luns :

Method:1 if sg3 rpm is installed , then run the command rescan-scsi-bus.sh

Method:2 Run the Command , echo - > /sys/class/scsi_host/hostX/scan

Q:43 How to find WWN numbers of HBA cards in Linux Server ?

Ans: We can find the WWN numbers of HBA cards using the command systool -c fc_host -v | grep port_name

Q:44 How to add & change the Kernel parameters ?

Ans: To Set the kernel parameters in linux , first edit the file /etc/sysctl.conf after making the changes save the
file and run the command sysctl -p , this command will make the changes permanently without rebooting the
machine.

Q:45 What is Puppet Server ?

Ans: Puppet is an open-source & enterprise software for configuration management toll in UNIX like operating
system. Puppet is a IT automation software used to push configuration to its clients (puppet agents) using code.
Puppet code can do a variety of tasks from installing new software, to check file permissions, or updating user
accounts & lots of other tasks.

Q:46 What are manifests in Puppet ?

Ans: Manifests, in Puppet, are the files in which the client configuration is specified.
Q:47 Which Command is used to sign requested certificates in Puppet Server ?

Ans: puppetca sign hostname-of-agent in (2.X) & puppet ca sign hostname-of-agent in (3.X)

Q:48 At which location Puppet Master Stores Certificates ?

Ans: /var/lib/puppet/ssl/ca/signed

Q:49 How to find all the regular files in a directory ?

Ans: using the command find /<directory -type f.

Q:50 What is load average in a linux ?

Ans: Load Average is defined as the average sum of the number of process waiting in the run queue and number
of process currently executing over the period of 1,5 and 15 minutes. Using the top and uptime command we
find the load average of a linux sever.

Q:51 What is the default port & configuration file of SSH Server ?

Ans: 22 is default port for ssh and /etc/ssh/sshd_config is the configuration file.

Q:52 How to change the default ssh port in linux ?

Ans: To change the port , first edit the file /etc/ssh/sshd_config , change the vaule of parameter port 22 , now
restart the ssh service.

Q:53 What is the configuration file of ssh client ?

Ans: /etc/ssh/ssh_config is configuration file for ssh client.

Q:54 What is SSH port forwarding ?

Ans: SSH Port Forwarding, sometimes called SSH Tunneling, which allows you to establish a secure SSH session
and then tunnel arbitrary TCP connections through it. Tunnels can be created at any time, with almost no effort
and no programming.

Syntax : ssh -L localport:host:hostport user@ssh_server -N

where:

-L port forwarding parameters

localport local port (chose a port that is not in use by other service)

host server that has the port (hostport) that you want to forward

hostport remote port

-N do not execute a remote command, (you will not have the shell, see below)

user user that have ssh access to the ssh server (computer)

ssh_server the ssh server that will be used for forwarding/tunneling


Without the -N option you will have not only the forwarding port but also the remote shell.

Q:55 How to disable the root login in linux server ?

Ans: Open the file /etc/ssh/sshd_config and chnage the paramenter PermitRootLogin yes to PermitRootLogin
no & restart the ssh service.

Q:56 How to allow only specific users to ssh your linux server ?

Ans: Open the file /etc/ssh/sshd_config and add the parameter AllowUsers user1 user2 & then restart the ssh
server.

Q:57 How to enable debugging in ssh command ?

Ans: To enable debugging in ssh command use -v option like ssh root@www.linuxtechi.com -v. To increase the
debugging level just increase the number of vs.

Q:58 What is the difference between ssh & Telnet ?

Ans: In ssh communication between client & server is encrypted but in telnet communication between the client &
server is in plain text . We can also say SSH uses a public key for authentication while Telnet does not use any
authentication.SSH adds a bit more overhead to the bandwidth compared to Telnet.Default port of ssh is 22 and
for telnet 23.

Q:59 What is use of sshpass command in linux ?

Ans: sshpass is a command which allows us to automatically supply password to the command prompt so that
automated scripts can be run as desired by users. sshpass supplies password to ssh prompt using a dedicated tty ,
fooling ssh to believe that a interactive user is supplying password.

Q:60 What is the use of scp command ?

Ans: SCP stands for Secure Copy ,it copies files between hosts over a network. It uses ssh for data transfer &
uses the same authentication and provides the same security as ssh. Unlike rcp, scp will ask for passwords or
passphrases if they are needed for authentication.

Q:61 What is the use of blowfish options in scp command ?

Ans: Using blowfish options in scp command , we can increase the speed, by default scp uses the Triple-DES cipher
to encrypt the data being copied.

Example : scp -c blowfish /home/itstuff.txt root@mail.linuxtechi.com:/opt/

Q:62 How to limit the bandwidth used by scp command ?

Ans: We can limit the bandwidth used by the scp command using the -l option as shown in the syntax.#scp -l
bandwidth_limit filename username@remote-host:/folder-name , where bandwidth_limit is numeric to be
specified in kilobits per second.

Q:63 How to enable passwordless ssh authentication in Linux ?

Ans: To Implement passwordless or Keys based authentication we have to generate Public and Private keys , Copy
the Pubic keys to remote Linux servers either manually or by ssh-copy-id command.ssh-copy-id command will
automatically copy the contents of id_rsa.pub file to ~/.ssh/authorized_keys file of remote linux server.
Q:64 How to check SSH servers Version ?

Ans: Using the command ssh -V we can find the ssh servers version.

Q:15 How to Copy the file server.txt from the local machine to a remote host using port 2751 in /opt folder.

Ans: scp -P 2751 /home/server.txt root@mail.linuxtechi.com:/opt

Q:65 Why to use NFS ?

Ans: A Network File System (NFS) allows remote machine to mount file systems over a network and interact with
those file systems as though they are mounted locally. This enables system administrators to consolidate resources
onto centralized servers over the network.

Q:66 What is the default port of NFS server ?

Ans: By default NFS uses 2049 TCP port.

Q:67 What are different versions of NFS Server ?

Ans: Currently, there are three versions of NFS. NFS version 2 (NFSv2) is older and widely supported. NFS
version 3 (NFSv3) supports safe asynchronous writes and is more robust at error handling than NFSv2; it also
supports 64-bit file sizes and offsets, allowing clients to access more than 2Gb of file data.

NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires an rpcbind service,
supports ACLs, and utilizes stateful operations. Red Hat Enterprise Linux 6.X & Centos 6.X supports
NFSv2,NFSv3, and NFSv4 clients. When mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv4 by
default, if the server supports it.

Q:68 What are configuration files of NFS server ?

Ans: '/etc/exports' is the main configuration file that controls which file systems are exported to remote hosts and
specifies options.

'/etc/sysconfig/nfs' is the file through which we can fix ports for RQUOTAD_PORT, MOUNTD_PORT,
LOCKD_TCPPORT, LOCKD_UDPPORT and STATD_PORT

Q:69 What are different options used in /etc/exports file ?

Ans: Below are list of options used in /etc/exports file :

ro: The directory is shared read only; the client machine will not be able to write to it. This is the default.

rw: The client machine will have read and write access to the directory.
no_root_squash: By default, any file request made by user root on the client machine is treated as if it is made by
user nobody on the server. (Exactly which UID the request is mapped to depends on the UID of user "nobody" on
the server, not the client.)

no_root_squash : if this option is used , then root on the client machine will have the same level of access to the files
on the system as root on the server. This can have serious security implications, although it may be necessary if you
want to perform any administrative work on the client machine that involves the exported directories. You should
not specify this option without a good reason.

no_subtree_check : If only part of a volume is exported, a routine called subtree checking verifies that a file that is
requested from the client is in the appropriate part of the volume. If the entire volume is exported, disabling this
check will speed up transfers.

sync : Replies to the NFS request only after all data has been written to disk. This is much safer than async, and is
the default in all nfs-utils versions after 1.0.0.

async : Replies to requests before the data is written to disk. This improves performance, but results in lost data if
the server goes down.

no_wdelay : NFS has an optimization algorithm that delays disk writes if NFS deduces a likelihood of a related
write request soon arriving. This saves disk writes and can speed performance

wdelay : Negation of no_wdelay , this is default

nohide : Normally, if a server exports two filesystems one of which is mounted on the other, then the client will
have to mount both filesystems explicitly to get access to them. If it just mounts the parent, it will see an empty
directory at the place where the other filesystem is mounted. That filesystem is "hidden". Setting the nohide option
on a filesystem causes it not to be hidden, and an appropriately authorised client will be able to move from the
parent to that filesystem without noticing the change.

hide : Negation of nohide This is the default

Q:70 How to list available nfs share on local machine & remote machine ?

Ans: 'showmount -e localhost' : Shows the available shares on your local machine

'showmount -e <Remote-server-ip or hostname>': Lists the available shares at the remote server

Q:71 What is pNFS ?

Ans: Parallel NFS (pNFS) as part of the NFS v4.1 standard is available as of Red Hat Enterprise Linux 6.4. The
pNFS architecture improves the scalability of NFS, with possible improvements to performance. That is, when a
server implements pNFS as well, a client is able to access data through multiple servers concurrently. It supports
three storage protocols or layouts: files, objects, and blocks.

Q:72 What is the difference between Hard mount & Soft mount in nfs ?

Ans: Difference between soft mount and hard mount is listed below :
Soft Mount : Consider we have mounted a NFS share using 'soft mount' . When a program or application requests
a file from the NFS filesystem, NFS client daemons will try to retrieve the data from the NFS server. But, if it
doesnt get any response from the NFS server (due to any crash or failure of NFS server), the NFS client will
report an error to the process on the client machine requesting the file access. The advantage of this mechanism is
fast responsiveness as it doesnt wait for the NFS server to respond. But, the main disadvantage of this method is
data corruption or loss of data. So, this is not a recommended option to use.

Hard Mount : Suppose we have mounted the NFS share using hard mount, it will repeatedly retry to contact the
server. Once the server is back online the program will continue to execute undisturbed from the state where it was
during server crash. We can use the mount option intr which allows NFS requests to be interrupted if the server
goes down or cannot be reached. Hence the recommended settings are hard and intr options.

Q:73 How to check iostat of nfs mount points ?

Ans: Using command 'nfsiostat' we can list iostat of nfs mount points. Use the below command :

# nfsiostat <interval> <count> <mount_point>

<interval> : specifies the amount of time in seconds between each report. The first report contains statistics for the
time since each file system was mounted. Each subsequent report contains statistics collected during the interval
since the previ-ous report.

<count> : If the <count> parameter is specified, the value of <count> determines the number of reports generated
at seconds apart. if the interval parameter is specified without the <count> parameter, the command generates
reports continuously.

<mount_point> : If one or more <mount point> names are specified, statistics for only these mount points will be
displayed. Otherwise, all NFS mount points on the client are listed.

Q:74 How to check nfs server version ?

Ans: 'nfsstat -o all' command shows all information about active versions of NFS.

Q:75 What is portmap?

Ans: The portmapper keeps a list of what services are running on what ports. This list is used by a connecting
machine to see what ports it wants to talk to access certain services.

Q:76 How to reexport all the directories of '/etc/exports' file ?

Ans: Using the command ' exportfs -r ' , we can reexport or refresh entries of '/etc/exports' file without restarting
nfs service
Q:77 What does VSFTPD Stands for ?

Ans: VSFTPD stands for Very Secure FTP Daemon.

Q:78 What are the defaults ports used in linux ftp server ?

Ans: Port 20 This is the data transfer port. All the all subsequent data transfers between the client and server are
done using this port.

Port 21 On this port control connection is established. All commands we send and the ftp servers responses to
those commands will go over the control connection, but any data sent back (such as ls directory lists or actual
file data in either direction) will go over the data connection.

Q:79 What are most common features of vsftpd ?

Ans:some of the Common Features are listed below :

Virtual IP configurations

Virtual users

Standalone or inetd operation

Powerful per-user configurability

Bandwidth throttling

Per-source-IP configurability

Per-source-IP limits

IPv6

Encryption support through SSL integration

Q:80 What is the configuration file of vsftpd ?

Ans: /etc/vsftp/vsftpd.conf

Q:81 How to restart the service of ftp server in linux ?

Ans: Service vsftpd restart or /etc/init.d/vsftpd restart

Q:82 Which Users tare not allowed to login via ftp ?

Ans: Users mentioned in the file /etc/vsftpd/ftpusers are not allowed to login via ftp.

Q:83 How to disable standard ftpd xferlog log format and enable default vsftpd log ?

Ans : Edit the file /etc/vsftpd/vsftpd.conf & make the below changes:

xferlog_std_format=NO

log_ftp_protocol=YES

The default vsftpd log file is /var/log/vsftpd.log


Q:84 What is default directory for ftp / Anonymous user ?

Ans : /var/ftp is the default directory for ftp or Anonymous user

Q:85 How to change the default directory for ftp / Anonymous user ?

Ans: Edit the file /etc/vsftpd/vsftpd.conf and change the below directive :

anon_root=/<Path-of-New-Directory>

After making above change either restart or reload vsftpd service.

Q:86 How to disable Anonymous user in vsftpd ?

Ans: Edit the conf file /etc/vsftpd/vsftpd.conf and chnage below directive and restart the ftp service.

anonymous_enable=NO

Q:88 What is chroot environment in ftp server ?

Ans: chroot environment prevents the user from leaving its home directory means jail like environment where
users are limited to their home directory only. It is the addon security of ftp server.

Q:89 How to enable chroot environment in vsftpd server ?

Ans : To enable chroot environment edit the file /etc/vsftpd/vsftpd.conf and enable the below directives :

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

The chroot_list_file variable specifies the file which contains users that are chroot.

Q:90 How to enable only limited/allowed users are able to login via ftp ?

Ans: This can be done by editing the file /etc/vsftpd/vsftpd.conf and add the below directives :

userlist_enable=YES

userlist_file=/etc/vsftpd.user_list

userlist_deny=NO

The file specified by userlist_file will now contain users that are able to login.

Q:91 How to set ftp banner in linux ?

Ans: Open the file /etc/vsftpd/vsftpd.conf and set the below directive :

ftpd_banner= Enter New Banner Here

Q:92 How To limit the data transfer rate, number of clients & connections per IP for local users ?

Ans: Edit the ftp servers config file(/etc/vsftpd/vsftpd.conf) and set the below directives :

local_max_rate=1000000 # Maximum data transfer rate in bytes per second


max_clients=50 # Maximum number of clients that may be connected

max_per_ip=2 # Maximum connections per IP

You might also like