Here are the answer for questions asked in redeployment test (Linux question Paper):
1) Which command is used to change settings on IDE hard disk drives?
1. hdparm
2. hddparm
3. diskparm
4. hdparam
5. ideconfig
Ans : hdparm
hdparm is a command line utility for the Linux operating system to set and view IDE hard disk hardware parameters. It can set parameters such as drive caches, sleep mode, power management, acoustic management, and DMA settings.
Before using hdparm it is important to read its man page
2) Your logfile shows repeated connections to TCP port 143. Which named service is being accessed?
1. imap
2. smbd
3. nmbd
4. pop2
5. smtp
Ans : imap By default imap runs on port 143.
3) What type of packet does an IP ping use (provide acronym)?
Ans : Internet Control Message Protocol i.e ICMP
4) To learn more about the management of an Internet site, the best utility to use would be:
1. whois
2. traceroute
3. ping
4. telnet
5. rpcdump
Ans : whois and telnet
5) If you had a Linux system routing 3 different Networks through 3 NICs and you were having trouble with your IP-Forwarding. where would you look to ensure that IP-Forwarding is actually enabled?
1. cat /proc/sys/net/ipv4/ip_forward
2. netstat
3. cat /proc/net/tcp
4. iptraf -d eth0
5. tail -f /var/log/messages
Ans : cat /proc/sys/net/ipv4/ip_forward
6) What file is used for associating port numbers to port names?
1. /etc/services
2. /etc/hosts
3. /etc/inetd.conf
4. /etc/securetty
5. /etc/ports
Ans : /etc/services
The /etc/services file enables server and client programs to convert service names to these numbers -ports. The list is kept on each host and it is stored in the file /etc/services. Only the “root” user is allowed to make modification in this file and it is rare to edit the /etc/services file to make change since it already contains the more common service names to port numbers. To improve security, we can immunize this file to prevent unauthorized deletion or addition of services
7) Which file can you create to prevent non-root users from logging into the system? (specify path and filename)
Ans : /etc/nologin
8) What command can be used to display a formatted output of the wtmp file? (no arguments)
Ans: # last
Last searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created. Names of users and tty’s can be given, in which case last will show only those entries matching the arguments. Names of ttys can be abbreviated, thus last 0 is the same as last tty0.
When last catches a SIGINT signal (generated by the interrupt key, usually control-C) or a SIGQUIT signal (generated by the quit key, usually control-\), last will show how far it has searched through the file; in the case of the SIGINT signal last will then terminate.
The pseudo user reboot logs each time the system is rebooted. Thus last reboot will show a log of all reboots since the log file was created
9) Which command can be executed by a user who is already logged into the system, in order to change to the root user? (type the command without any parameters)
Ans : “su”
10) Type the full command you could use to decompress the file “foo.gz”
1. gzip -d foo.gz
2. gunzip -d foo.gz
3. gunzip foo.gz
4. unzip foo.gz
5. decompress foo.gz
Ans : gunzip foo.gz
11) You need to find out which package owns a file called /etc/paper.config. Which command will answer this question?
1. rpm -qf /etc/paper.config
2. rpm -qa|grep /etc/paper.config
3. rpm -Fq /etc/paper.config
4. rpm -q /etc/paper.config
5. rpm –requires /etc/paper.config
Ans : rpm -qf /etc/paper.config
You can find out which rpm a file belongs to by using the rpm -q -f command. You must have the redhatrpmdb rpm installed though.
12) Where are source RPMs installed?
A. /usr/src/linux/rpms/
B. /var/src/linux/rpm/
C. /var/rpm/src/
D. /var/linux/rpm/src/
Ans : None of above.
Source RPMs are installed in /usr/src/redhat. There are 5 subdirectories under there. SOURCES contains the original source code. SPECS contains the specification files that control the RPM build process. BUILD is where source code is uncompressed and built. SRPMS contains the source RPM that is created when you build one.
13) How can you turn off interface eth1?
A. service network stop
B. service netork stop eth1
C. ifstop eth1
D. ifdown eth1
E. ps -aux |grep eth1| kill `awk -f {$1}`
Ans : ifdown eth1
14) What directory contains the kernel?
A. /
B. /kernel
C. /etc
D. /boot
E. /var/log
Ans : /boot
15) How can you see the kernel routing table?
A. netstat -Route
B. netstat -rn
C. netstat -an
D. route show default gw
E. netstat
Ans : netstat -rn
16) How do you enable quotas on a partition in /etc/fstab?
A. Add the enforcequotas option
B. You don’t. Quotas are turned on automatically when you install the quota rpm.
C. Add the quota option.
D. Add the usrquota and grpquota options.
E. You put a 1 in the last column.
Ans : Add the usrquota and grpquota options
To enable quotas on a partition you put the userquota and groupquota option in the options section for the partition in /etc/fstab.
17) How can a user set up their own crontab entry?
A. vi ~/.crontab
B. cp /etc/crontab .
C. crontab -v
D. crontab -e
E. cron –edit
Ans : crontab -e
18) What command will turn off the ftpd service in all runlevels?
A. chkconfig ftpd off
B. rm /etc/rc.d/init.d/*ftpd*
C. chkconfig –levels 12345 ftpd off
D. service ftpd stop
E. service ftpd stop -persistant
Ans : chkconfig –levels 12345 ftpd off
19) Which parameters are use in rsync command to copy file/folder from source to destinations with same permission, ownership and groups ?
Ans : rsync –pog
20) Write the rysnc command transfer File and subdirectory under “eukhost” directory to the /backup directory on remote host eukhost.com ( port number is 39393)
Ans : The correct command is as follows:
#/usr/bin/rsync -vrplogDtH -e “ssh -p 39393” eukhost [email protected]:/backup/
21) Which is the command to enable suid /etc/hosts file .
Ans : # chmod a+s /etc/hosts
22) Which following command will show only server hostname
1. uname -h
2. uname -a
3. uname -n
4. uname –r
Ans : # uname -n
23) What does the following cron entry do?
10 5 * * * /bin/foo
A. runs /bin/foo every 10 minutes 5 days a week
B. runs /bin/foo at 10:05 AM every day
C. runs /bin/foo on the 10th of May every year
D. runs /bin/foo at 5:10 AM every day
Ans : runs /bin/foo at 5:10 AM every day
The fields are: minute, hour, day of month, month, day of week
24) You have created a /home/projectx directory with the owner of projectx and a group of projectx. How can you set its permissions so that all files created in this directory are owned by the projectx group?
A. chown projectx.projextx /home/projectx
B. chgrp projectx /home/projectx
C. chmod 755 /home/projectx
D. chmod g-s /home/projectx
E. chmod g+s /home/projectx
Ans : chmod g+s /home/projectx
25) What command do you use to edit the default grace period for quotas?
A. quotaconfig -g
B. editquota -g
C. quotaconfig -t
D. edquota -t
E. quotaeditor –grace
Ans : edquota -t
26) What file contains the configuration for BIND?
A. /etc/bind.conf
B. /etc/named.conf
C. /etc/dns.conf
D. /var/named/bind.conf
E. /var/named.conf
Ans : /etc/named.conf
27) Which file contains the list of terminals that root is allowed to log into?
A. /etc/rooterm.conf
B. /etc/terminals
C. /etc/secure
D. /etc/tty.conf
E. /etc/securetty
Ans : /etc/securetty
28) How can you find out which ports are being used?
A. ifconfig -a
B. netstat -a
C. netstat -rn
D. ports
E. cat /etc/services
Ans : netstat –a
29) You want to add a directory to all users paths. What file should you edit to do this?
A. /etc/sysconfig/profile
B. /etc/sysconfig/profile
C. /etc/bashrc
D. /etc/profile
E. /etc/env
Ans : /etc/profile
The /etc/profile script is used for system-wide enviornment variables and startup files. You could also create a new file in /etc/profile.d/ that ends in .sh and set the enviornment variable in there. Keep in mind that not all users will necessarily use bash
30) Sendmail is an example of a(n):?
A. MTA
B. MUA
C. MDA
D. MLA
E. All of the above
Ans : MTA
31) Which files are used to configure TCP Wrappers?
A. /etc/tcpwrapper.conf and /etc/hosts.conf
B. /etc/hosts.allow and /etc/hosts.deny
C. /etc/tcpwrapper.conf and /etc/xinetd.conf
D. /etc/access.conf and /etc/xinetd.conf
E. /etc/tcpwrapper and /etc/access.conf
Ans : /etc/hosts.allow and /etc/hosts.deny
32) Which options to chmod allow read access to all but only allow write and execute access to the owner?
A. chmod 777 filename
B. chmod 700 filename
C. chmod 744 filename
D. chmod 447 filename
E. chmod 775 filename
Ans : chmod 744 filename
33) Which file do I edit to prevent specific users from accessing an ftp server?
A. /etc/hosts.allow
B. /etc/hosts.deny
C. /etc/ftpacess
D. /etc/ftpusers
E. /etc/ftpd.conf
Ans : /etc/ftpusers
34) Which file do you edit to set the default runlevel?
A. /etc/grub.conf
B. /etc/lilo.conf
C. either A or B
D. /etc/inittab
E. /etc/runlevel
Ans : /etc/inittab
35) How do I immeadiately restart a Linux system?
A. Turn off the monitor then turn off the CPU.
B. /sbin/stop
C. init 6
D. shutdown -r now
E. None of the above
Ans : shutdown -r now
36) How do you install an RPM?
A. rpm -evh packagename.rpm
B. rpm -ivh packagename.rpm
C. rpm -q packagename.rpm
D. rpm -qa *.rpm
E. rpm -ql *.rpm
Ans : rpm -ivh packagename.rpm
37) Which is default firewall in Linux
A. apf
B. csf
C. iptables
D. black
Ans : iptables
38) Define following command with usage()
Pwd : Print the full pathname of the current working directory.
Ps : report a snapshot of the current processes.
Netstat : The netstat command symbolically displays the contents of various net-work-related data structures
Grep : searches the input files, selecting lines matching one or more patterns; the types of patterns are controlled by the options specified.
39) Write down a command to check just MX record of domain http://eukhost.com.
Ans : dig mx eUKhost.com +short
40) How to check the version of linux installed on your server via command line.
Ans : cat /etc/redhat-release
41) Apache runs under privileges of which user?
1. apache
2. nobody
3. root
4. no user
Ans : nobody
42) Write down command you will use to bind muliple ip to your NIC card(eth0)
Ans Step 1 : #cd /etc/sysconfig /network-scripts
step 2 : #cp icfg-eth0 ifcfg-eth0:0
#cp ifcfg-eth0 ifcfg-eth0:1
#cp ifcfg-eth0 ifcfg-eth0:2
Step 3 : #vi ifcfg-eth0:0
step 4 : # ifup eth0:0
Repeat step 3 and 4 but make sure to update correct device and IPadd
43) How to set date & time on a system.(set it to 27th oct 2007 and 13:00hrs)
Ans : date –set=’Sun Oct 27 13:00:00 IST 2007′
44) How to block a IP address with iptables? (10.10.10.123)
Ans : iptables –A INPUT –s 10.10.10.123 –j REJECT
45) Set hostname of your server permanetly to support.eukhost.com(Write down commands and files which you edit)
Ans : # hostname support.eukhost.com
# edit /etc/hosts and add following line on first link
support.eukhost.com support
#edit /etc/sysconfig/network and replace the parameter HOSTNAME with new hostname.
# reboot to make sure that it setup permanetly.
46) How to find which php.ini file is in use ?
Ans : php –i | grep php.ini
47) How I can kill all process accessimng /tmp partition
Ans : fuser –km /tmp
48) How would you rebuild your RPM database.
Ans : rpm –rebuilddb -v -v
49) How can you determine which shell you are using ?
Ans : echo $SHELL
50) Which UNIX command will control the default file permissions when files are created?
Ans : umask
51) What is difference between du and df command
Ans : du : The du utility displays the file system block usage for each file argument and for each directory in the file hierarchy rooted in each directory argument. If no file is specified, the block usage of the hierarchy rooted in the current directory is displayed. If the -k flag is specified, the number of 1024-byte blocks used by the file is displayed
df : df utility displays the amount of disk space occupied by mounted file systems(partitions), the amount of used and available space, and how much of the file system’s total capacity has been used. The file system is specified by device, or by referring to a file or directory on the specified
52) How to remove duplicate rpm?(use rpm command)
Ans : rpm -e –nodeps –allmatches
53) Biggest number that an IP address can have in any of its octet is ?
a) 256
b) 255
c) 264
d) 254
Ans : 255
54) What is a quick way to see all users with the UID of 0 on the shell ?
Ans : cat /etc/passwd| grep “:0:”
55) What is significance of Add_Module and Load_module in default httpd.conf
Ans : Load_module : The LoadModule directive links in the object file or library filename and adds the module structure named module to the list of active modules.
Module is the name of the external variable of type module in the file, and is listed as the module Identifier in the module documentation.
Add_module : The server can have modules compiled in which are not actively in use. This directive can be used to enable the use of those modules. The server comes with a pre-loaded list of active modules; this list can be cleared with the ClearModuleList directive.
You will find details information about it at http://httpd.apache.org/docs/1.3/mod/core.html
56) What is a simple method to stop the DDOS attack on a domain.
Ans : Changed the A record for domain to point to 127.0.0.1
- Cookie and Session Fixation - October 16, 2008
- Windows Server 2003 - August 13, 2008
- SQL Server - August 9, 2008