Linux Interview1

download Linux Interview1

of 39

Transcript of Linux Interview1

  • 7/23/2019 Linux Interview1

    1/39

    OPERATING SYSTEM BASICS

    What is your favourite OS and why?Any good unix candiate believes in 'the right tool for the job'. Anyone who says that 'Linux is the answerto everything' is fooling themselves. All the different Unix OS's have their advantages, and the ey tohaving them ex!lain theirs. "hey don't have to agree with you# that's the ey. $ut they should at leastmae sense. $ut don't hold it against them if the answer is '$ecause % now that OS the best'. %t's acommon one.

    Why paging is used?"he act of moving !ages of memory from &A to virtual memory on a hard drive. Linux users term thisas S(A).

    Explain the concept of virtual memory.

    )hysmem, Swa!, and !aging.*irtual memory is hardware techni+ue where the system a!!ears to have more memory that it actuallydoes. )aging &A - *irtual emory

    What is fragmentation?ragmentation occurs when a !iece of data in memory is broen u! into many !ieces that are not closetogetherOR

    ragmentation occurs when the o!erating system cannot or will not allocate enough contiguous s!ace tostore a com!lete file as a unit, but instead !uts !arts of it in ga!s between other filesScattered /ata

    What is multi tasking?ulti tasing0 "he conce!t of multitasing is +uite similar to multi!rogramming but difference is that the

    switching between jobs occurs so fre+uently that the users can interact with each !rogram while it isrunning.

    What is the difference between a thread! and a process!?"rocess# A !rocess is a collection of virtual memory s!ace, code, data, and system resources.$hread# A thread is code that is to be serially executed within a !rocess. At least one thread exists withineach !rocess. %f multi!le threads can exist within a !rocess, then they share the same memory and fileresources.

    What is Semaphore?Locing echanism used inside resource mangers and resourse dis!ensers.

    Whats the difference between %ache and &uffer%ache#

    irst time accessing the data gets cache in the &A, Once the data is moved from dis into the cache,future use can be made by accessing the cached co!y rather than refetching or recom!uting the originaldata, so that the average access time is lower&uffer#

    emory used to tem!orarily store out!ut or in!ut data, which is not yet written to dis.

    1

  • 7/23/2019 Linux Interview1

    2/39

    LINUX BASICS

    What are the main flavors of '()*?System + ,five- from $/$ &erkeley Software 0istribution

    2)3U4%5 ree$S/%$3A%5 4et$S/

    S6O3U4%5SOLA&%S

    Who introduced '()*7en "hom!son

    What two organi1ations first developed '()*?$ell Labs$ereley Software /istribution

    )n what high level programming language is '()* written?

    869 )rogramming Language

    Whats the difference between S2S+ and &S0Sys+ &S0

    1. &un control scri!ts are under :etc:init.d :etc:rc.d;. Organises scri!ts for starting and sto!!ing services %t has a single scri!t for each runlevel. into a directory for each runlevel

    )S linux comes under S2S+ or &S0Linux has features of both

    What is 3S34 5(' and 5"6? 5ive a brief on each?3S3# ree Software oundation"he ree Software oundation ation founded by &ichard Stallman to su!!ortthe free software movement 5"6# 5eneral "ublic 6icense"he ?4U ?eneral )ublic License

  • 7/23/2019 Linux Interview1

    3/39

    Who is the founder of 3S3?&ichard Stallman

    Who developed 6inux kernel?Linus "orvalds

    Whats the version of kernel in different release of Red7at 6inux?&edhat Linux *ersion 4ame /ate 7ernel *ersionB.C *alhalla ;.D.1E3CE )syche ;.D.E31DF Shrie ;.D.;G3E

    edora 6ore *ersion 4ame /ate 7ernel *ersion1 Harrow 4ovember I, ;GGC; "ettnang ay 1E, ;GGDC 2eidelberg 4ovember E, ;GGDD Stent> June 1C, ;GGII $ordeaux arch ;G, ;GGK

    &ed2at nter!rise Linux ;.1nter!rise Server

  • 7/23/2019 Linux Interview1

    4/39

    Whats the differences between every release of 3edora %ore

    Whats the difference between Red7at Enterprise 6inux and 3edora %ore "ro=ectsR7E6 3edora

    1. &2L is intended for commercial use edora 6ore is intended for !ersonal, hobbyist, anddevelo!er use

    ;. &2L C is based on still redhat F src code edora 6ore C is much advance having latest ernel;.K and newer develo!er tools.

    C. &2L D is based on 6C. edora 6ore D is having latest gcc and tools.D. &ed2at Su!!ort 4o Su!!ortI. 6ost $ased ree

    What is a kernel?"he ernel is the core !iece of most o!erating systems. %t is a !iece of software res!onsible for thecommunication between hardware and software com!onents.

    )s 6inux >ernel a modular or monolithic?Linux is a module3loading monolithic ernelodern monolithic ernels such as Linux, ree$S/ and Solaris can load executable modules at runtime,allowing easy extension of the ernel's ca!abilities as re+uired, while hel!ing to ee! the amount of coderunning in ernels!ace to a minimum.

    Explain iostat4 vmstat and netstat.iostat 3 &e!orts on terminal, dis and ta!e %:O activity.vmstat 3 &e!orts on virtual memory statistics for !rocesses, dis, ta!e and 6)U activity.m!stat 3 &e!ort !rocessors related statistics.netstat 3 &e!orts on the contents of networ data structures.

    Explain 3ile System 7ierarchy and brief into for each?(ame some top

  • 7/23/2019 Linux Interview1

    5/39

    7ow many number of swap files you will create? What is the maximum total si1e for

    SW"?&ed 2at nter!rise Linux ;.1 su!!orts u!to C; swa! !artitions, each can be a maximum si>e of ;?$.aximum total swa! si>e is KD?$.&2L C su!!orts swa! si>e till 1"$

    Why SW" si1e cant be more than 85& ih R7E6 8.:mswa! su!!orts only ;?$, Hou have to have fixed mswa! to mae swa! larger than ;?$

    7ow do you create a swapfile?6ets say im running out of SW" space4 what u!ll do in this case.

    % would create a swa! file for tem!orary !ur!ose KIb swa! si>eN dd if-:dev:>ero of-:data:swa!file.1 bs-1G;D count-KIICKN mswa! :data:swa!file.1N swa!on Ma :data:swa!file.1

    nd if incase ) would need this swap file at boot time permanently

    N dd if-:dev:>ero of-:data:swa!file.1 bs-1G;D count-KIICK

    N mswa! :data:swa!file.1Add an entry in :etc:fstab file

    :data:swa!file.1 none swa! !ri-I,defaults G GN swa!on Ma

    7ow to list only the directories inside a directoryls Ml gre! @Pd@

    What is default permissions for others in a file?&ead Only

    7ow much disk space should you allocate for the proc filesystem?(e dont have to. %t does not consume any storage s!ace, and it consumes only a limited amount ofmemory.

    What are 6inux Runlevels and how do they workG halt1 single user mode; multi user mode

  • 7/23/2019 Linux Interview1

    6/39

    What is difference between grep / find?5RE"0 get regular ex!ressionrom gre! you cant search files. Used to search for a string from a file

    3)(00rom find you can search by filenames. Used to search for a string from a file

    Which command is used to get ')05)0 of a user?id Mu 8username9id Mg 8usrname9

    What is difference between find and locate?Locate or slocate

  • 7/23/2019 Linux Interview1

    7/39

    disa!le

    /ays since Jan 1, 1FBG that account is disabledreser"ed

    A reserved field

    "he !revious exam!le might then be0username:Npge08pfz4wuk:9479:0:10000::::

    7ow does enabling shadow passwd@s change the functionality of user authentication?

    Why is there an etcshadow ,or similar4 differently

  • 7/23/2019 Linux Interview1

    8/39

    cron assumes your system is running. continuously.

  • 7/23/2019 Linux Interview1

    9/39

    7ow do you create directory and subdirectories when the parent directory may exist4 in one

    command? )n other words4 create the following directory structure.

    homeuseronetwo $he command should work whether homeuser exists or not.mdir 3! :home:user:one:two "he 3! or @!arents@ maes the !arent directory as needed.

    )f someone talks about ext8 and extD filesystems4 what are they most likely running

    0ebian or Redhat?&ed2at

    7ow do you create a directory that@s sharable to a group4 that by default4 will have each file

    created as sharable to a group.dir dir6hmod BBG dir

    What options to ,5('- tar,:- would you use to decompress and extract everything from

    an archive named files.tar.g1 into the current directory?

    N tar M>xvf file.tar.g>

    )f you mistype a password4 how do you clear it out to retype the password again.6trl36 .

    What are the types of file systemsxt;xtC&eiserfsJfs5fs

    isoFKKG 3 6/&O

    What is default block si1e in 6inux?

    )f fsck is running4 what is the one thing you shouldn@t do?4ot to start any !rograms/o not try to fsc on a currently mounted filesystem

    What command would you use to check available disk space on all currently

  • 7/23/2019 Linux Interview1

    10/39

    there is no need to defragment an ext !artition xvf file.tar.g> filename

    )s there a way to change the date< and timestamp on a file?Hes, this can be done with the 'touch' command using the 3t flag.

    xam!le0touch 3t ;GG;GF1C1KGG myfile.txt"his will set the date3 and timestam! to the 1Cth of Se!t ;GG;, 1K0GG.

    7ow do ) remove those enoying FG chars from textfiles that has been generated on a

    Gicrosoft platform?Use the 'tr' command to remove them lie this0N cat thefile.txt tr 3d 'Vr'"his will out!ut the new file without the P charters to your standard out!ut. Just redirect them using the'' char to get the result in to a file lie this0N cat thefile.txt tr 3d 'Vr' newfile.txt

    tr M translate3d deleteVr return

    7ow do you give a user access to an application or program that needs to run as root

    without giving them the root password?% would use sudo or setuid

    What are the steps involving the recompilation of the linux kernel

    1. untar the tar file into :usr:src:ernel;. vi aefile %mageK. c! :ernel:arc:iCEK:boot:bs%mage to :boot:b>%mageB. c! :ernel:system.ma! to :boot:system.ma!E. maeF. mae chec1G. mae install

    7ow do ) find out who is logged into the system?who,w

    What directory is typically used as scratchspace?:tm!

    7ow do ) stop a '()* system?halt,init,shutdown

    Whats the difference between halt and shutdown

    1G

  • 7/23/2019 Linux Interview1

    11/39

    $oth are same

    What does fsck do?fixes filesystem errors

    What kind of permission would chmod HII yeild on a file?U - rwx, g:o rx

    What is an s in a file@s permission mean?setuid

    What does a b as the first letter of a file@s permissions mean?bloc s!ecial

    7ow do ) make a new disk available for files?m!art:new!art, mfs, mount

    )f )@m logged in as root4 what command lets me become another user id?

    su

    What@s the difference between su and su

  • 7/23/2019 Linux Interview1

    12/39

    What is an * Server?gra!hical dis!lay device,Bo!tional

    What are two * %lients?xterm, xcloc, netsca!e, 6/, etc...

    @7ow about trussktracestrace? What are they good for?

    What is 6)6O?L%LO stands for Linuxboot loader. %t will load the $&, master boot record, into the memory, and tellthe system which !artition and hard drive to boot from.

    What is the main advantage of creating links to a file instead of copies of the file?A0 "he main advantage is not really that it saves dis s!ace

  • 7/23/2019 Linux Interview1

    13/39

    cvs removecvs commit

    What is "G

    What is Kouranaling"he act of moving !ages of memory from &A to virtual memory on a hard drive. xcessive !aging iscaused by a lac of actual system memory. %n this case the system has to use the hard drive as memoryfre+uently, and !erformance is degraded.

    What are the main differences between pache :.x and 8.x?

    What does the LrouteM command do?

    What are the readwriteexecute bits on a directory mean?

    What is SE0?S/

  • 7/23/2019 Linux Interview1

    14/39

    *erify this with the following command0ulimit 3nulimit 3a

    Loo for line0o!en files

  • 7/23/2019 Linux Interview1

    15/39

    7ow would you find all the processes being run by user =oe?System I0 !s 3fe gre! joe$ereley0 !s 3auxww gre! joe

    "here are two unix machines named A and $ that are on the same subnet. /escribe to me, in as muchdetail as !ossible, what ha!!ens when % ty!e @telnet $@ from a terminal on machine A.

    Linu B%%t Pr%'ess

    7ow would you grab the middle DNN lines of a :NNN line file4 grab the second field of every

    line in that range4 and sort the result alphabetically using only piped commands from the

    toolbox?

    Ba'(up and Rest%re

    What is a level N backup?]10 level G bacu! is normal or full bacu!. A normal bacu! disregards

    the archive bit in all files and bacs u! all files and folders selected, regardless of when they weremodified. A normal bacu! is the most com!lete ty!e of bacu!, and the only ty!e of bacu! that can beused to bac u! the registry and other critical system files. A normal bacu! taes the longest amount oftime to bac u! and recover. A normal bacu! clears the archive bit on all files after bacing u!.

    ];. n incremental backup is the uickest method for performing backups of data. n

    incremental backup only backs up files that have been created or modified ,their archive bit

    is set to :- since the last normal or incremental backup. n incremental backup also clears

    the archive bit ,sets the archive bit back to N- of all files that it backs up.

    ]C. reinstall the os.start 3 run 3 ty!e 8ntbacu!9 3 o 3 next 3 select restore 3 next 3 select bacu! files 3 next 3finish

    Basi' Netw%r(in&

    What@s a socket? What@s a port? 7ow do you reserve them? how are they related? 7ow do

    you find out what@s going on with them on a system?4ormally, a server runs on a s!ecific com!uter and has a socet that is bound to a s!ecific !ort number."he server just waits, listening to the socet for a client to mae a connection re+uest.Socket0 %) )ort

    "ort0 is a virtual data connection. )rograms binds on the !ort to exchange the data.

    What would you use to view the contents of $%" packets on the network

    A tcpdump

    7ow would you check $%" packets coming from Remote )"?

    A tcpdump Bi PinterfaceQ src P)"Q

    1I

  • 7/23/2019 Linux Interview1

    16/39

    7ow do ) set my SS7 server to accept only protocol 8 connections?6hange the )rotocol )arameter to 8;9:etc:ssh:sshd^config

    )rotocol ;service sshd restart

    J. 7ow do you setup multiple )" address on one ()% ,(etwork )nterface %ard-...assume

    ethernet.

    What should be found in the etchosts file?

    7ow would you check the route table on a workstationserver$rouble Shooting

    9. Where would you look for startup and error messages on a 'nix server?:var:adm:messages

  • 7/23/2019 Linux Interview1

    17/39

    What is striping?A techni+ue for s!reading data over multi!le dis drives. /is stri!ing can s!eed u! o!erations thatretrieve data from dis storage. "he com!uter system breas a body of data into units and s!reads theseunits across the available diss. Systems that im!lement dis stri!ing generally allow the user to select thedata unit si>e or stri!e width./is stri!ing is available in two ty!es. Single user stri!ing uses relatively large data units, and im!roves

    !erformance on a single3user worstation by allowing !arallel transfers from different diss. ulti3userstri!ing uses smaller data units and im!roves !erformance in a multi3user environment by allowingsimultaneous

  • 7/23/2019 Linux Interview1

    18/39

    AnswerHes, this can be done with the 'host' command. 2ave a loo at the man!age for more information on howto use it.

    xam!le0

    N host mrerisson.net

    mrerisson.net has address K;.;G.1GK.11Fmrerisson.net mail is handled

    %s there some interactive way to view active !rocesses in the system based on their si>e or c!u3usageTAnswerany unix:linux systems comes with a command called 'to!' that does this. See the man!age for to! fordetailed information on how to dis!lay !rocesses based on c!u3 or memory3usage.

    ,e! Ser"erhow to install and configure an A!ache (eb server.2ow do % now what modules % have availible in my installation of a!acheT

    Answerxecute0 'htt!d 3l', this will show you a list of all availible modules.

    33333333333333333333333333333333333333333333333333333333333333333333333333333333

    ]uestion ;(hat user should the stand3alone server be ran asT

    Answer%t should be ran as root to be able to attach to !ort EG. A!ache will then s!awn it's children with the owneryou s!ecify in the htt!d.conf file.

  • 7/23/2019 Linux Interview1

    19/39

    ]uestion D6an % !revent a user to override my global settings with the .htaccess fileT

    AnswerHes, you can do this with the 'AllowOverride' o!tion in the config file.

    xam!le0

    /irectory :AllowOverride 4one:/irectory

    "his will !revent users from using the .htaccess file in all directories.

    33333333333333333333333333333333333333333333333333333333333333333333333333333333

    ]uestion I%s the User/ir module safe to useT

    Answer"he User/ir module is said to be safe if the html !ages arn't stored in the users homedirectory. %nsteadyou should set u! an additional directory for each user outside it's homedirectory, and use the followingconfiguration0%fodule mod^userdir.cUser/ir :home:htt!d:R::%fodule

    And for each user have a directory, which they own, under :home:htt!d:, with the same name as the user."his will enable users to have an U&L lie htt!0::host.fo: user

    33333333333333333333333333333333333333333333333333333333333333333333333333333333

    ]uestion K2ow should % configure A!ache to mae it serve (A) !agesT

    AnswerHou should add these lines to your A!ache configuration0

    Add"y!e text:vnd.wa!.wml .wml .wml

    Add"y!e A!!lication:vnd.wa!.wmlc .wmlcAdd"y!e text:vnd.wa!.vmlscri!t .wmlsAdd"y!e A!!lication:vnd.wa!.wmlscri!tc .vmlscAdd"y!e image:vnd.wa!.wbm! .wbm!

    "he you should locate the '/irectory%ndex' directive in the file, and add the 'index.wml' tag to it, shouldloo something lie this afterwards0

    %fodule mod^dir.c/irectory%ndex index.html index.wml

    1F

  • 7/23/2019 Linux Interview1

    20/39

    :%fodule

    "his tells A!ache to loo for a file named index.wml if no file is s!ecified in the re+uested U&L.

  • 7/23/2019 Linux Interview1

    21/39

    33333333333333333333333333333333333333333333333333333333333333333333333333333333

    ]uestion E%s there a way to allow virtual hosts to have their own cgi3bin directoryT

    AnswerHes, this can be s!ecified using the Scri!tAlias3o!tion in the *irtual2ost bloc that you want to enablethis for.

    xam!le0

    *irtual2ost RServerAdmin webmasterfoo.bar/ocument&oot :home:htt!d:www.foo.bar:!ublic^html:Server4ame foo.barServerAlias www.foo.bar

    Scri!tAlias :cgi3bin: :home:htt!d:www.foo.bar:cgi3bin:rrorLog :home:htt!d:www.foo.bar:logs:error^log6ustomLog :home:htt!d:www.foo.bar:logs:access^log common:*irtual2ost

    4ote0%t's im!ortant that you end the !ath to the cgi3bin directory with a slash

  • 7/23/2019 Linux Interview1

    22/39

    7now the o!tions available in :etc:named.conf.

    /4S3333333333333

    N (hat is /4S/4S stores the database of domain name and its corres!onding %)s.

    %t is used for translating domain name to %) and vice versa

    N (hat !ort no does /4S usesTIC

    N (hat are the ty!es of /4ST6aching 4ame Servernamed.ca

  • 7/23/2019 Linux Interview1

    23/39

    "o define the ail ServerQ How one can configure round robin in DNS server in linux

    www.dgshiping.com IN A 1.2..1www.dgshiping.com IN A 1.2..2www.dgshiping.com IN A 1.2..

    Q How !o se! "# $riori!% in DNS Server&g )riority can be given for any three Server

    5 1G mailhost5 1GG mailhost.matrix.co.in.5 ;GG www.matrix.com.

    ] on what ver. "he $%4/ was runningT F.; ver.

    N-S Ser"er

    What is (3S?

    4S is 4etwor ile System%t is basically used for sharing files _ directories on a networ.

    What is its =ob?

    allow machines to mount a dis !artition on a remote machine

    Why is it necessary to start portmap service before nfs service

    )ortma! serves &)6 calls which is necessary for 4S

    What is R"%

    Library routines for remote !rocedure calls"hese routines allow 6 !rograms to mae !rocedure calls on other machines across the networ.

    On which !ort 4S runsT;GDF

    (hich service is re+uired for 4STN service !ortma! startN service nfs start

    (hich daemons are re+uired for 4ST&+uotadountd4fsd4locmgr

    4ame the configuration file for 4ST:etc:ex!orts

    ;C

    http://1.2.3.1/http://1.2.3.2/http://1.2.3.3/http://1.2.3.1/http://1.2.3.2/http://1.2.3.3/
  • 7/23/2019 Linux Interview1

    24/39

    2ow would you share :home:ex!orts to a s!ecific machine

  • 7/23/2019 Linux Interview1

    25/39

    F. "hese hel!er damons, lie all daemons, needs !orts to bind to monitor andrun on. Are these !orts given in :etc:servicesT

    A0 4o

    1G. "hen how do these daemons get !ortsT

    A0 !ortma!!er daemon is used to dynamically assign !ort nos to these &)6services which can be seen by @r!cinfo 3!@. %n :etc:r!c

    11. (hat !ort does 4S useT

    A0 ;GDF

    1;. And how do you now thatT

    A0 :etc:services

    1C. (hat !ort does !ortma!!er useT

    A0 111

    1D. &)6 services have their own config file. (hat is itT

    A0 :etc:r!c

    1I. /is!lay a list of 4S shares from a client if the server is shiva

    A0 showmount 3e shiva

    1K. 2ow does one chec the status of a 4S serverT

    A0 showmount 3e localhost

    1B. (hich file is configured on a 4S server to facilitate sharing across a 4(T

    A0 :etc:ex!orts

    1E. 2ow does one refresh 4S sharesT

    A0 ex!ortfs 3ra

    1F. (hat does this refresh meanT

    A0 "elling the 4S daemon to re3!rocess :etc:ex!orts and rebuild the 4Smount table config file, which is...., cannot say, since it a +uestion.See later.

    ;G. (hich 4S file shows the ex!ort !ermissions of all ex!orted directories T

    ;I

  • 7/23/2019 Linux Interview1

    26/39

    A0 :var:lib:nfs:rmtab

    ;1. (hich 4S file shows the info about currently ex!orted dirs, which 'mountd' reads when !rocessing client mount re+uests and is rebuilt every time

    'ex!ortfs' is runT

    A0 :var:lib:nfs:xtab

    ;;. 2ow would you chec who remote hosts were using your 4S server andwhich files were in useT

    A0 nfsstat 3a

    ;C. % wish to tem!orarily ex!ort a dir :joes on shiva to brahma with r:w!erms. 2owT

    A0 ex!ortfs brahma0:joes 3o rw

    ;D. "em!orarilyT (hat's thatT

    A0 %t isn't configured in :etc:ex!orts and on a 'service nfs restart'would no longer exist#

    ;I. 2ow would you do the same !ermanently T

    A0 6onfigure :etc:ex!orts 0 :joes brahma

  • 7/23/2019 Linux Interview1

    27/39

    brahma in r:o mode

    C1. 2ow would a user foo on a remote client brahma mount this on her localem!ty dir :win T

    A0 6annot. Only root can do remote 4S mounts. "his is how 0

    mount ganesh0: :win

    C;. 6an a user foo delete any files in the 4S share winT

    A0 4o

    CC. (hat about the local rootT

    A0 4o

    CD. (hy not T

    A0 Local root is s+uashed by the 4S server by default

    CI. s+uashed T

    A0 Local root is converted to another user.

    CK. So what user is this local root s+uashed toT

    A0 nfsnobody.

    CB. And is this a *LU T

    A0 Hes#

    CE. And what is this nfsnobody's user:grou! idT

    A0 KIICD:KIICD

    CF. /id you create this userT

    A0 4o way# %t's what's called a system a:c. 6reated on install by &2

    DG. 4ow examine this :etc:ex!orts file on ganesh0

    : shiva

  • 7/23/2019 Linux Interview1

    28/39

    share's rw !erms on it. So T

    A0 ls 3ld : on ganesh show this 0 drwx3r3xr3x

    Although 4S does allow it, dir !erms of the OS do not forno @w@ for 'others'.

    'root', meanwhile, has also been s+uashed#

    D;. x!lain the following :etc:ex!orts file 0

    : shiva

  • 7/23/2019 Linux Interview1

    29/39

    2ere, all re+uests are ma!!ed to uid 1GG e-E1F;,wsi>e-E1F;

    II. 2ow would you automate a 4S 6lient with all the above considerations inmindT

    A0 %n :etc:fstab a!!end the following line 0

    ganesh0:joes :funny nfs soft,intr,rsi>e-E1F;,wsi>e-E1F; G G

    ;F

  • 7/23/2019 Linux Interview1

    30/39

    and mae sure the netfs daemon starts at boottime. And of course!ortma!

    IK. (hat is the default for the read and write buffer T

    A0 DGFK

    IB. 2ow many columns does :etc:fstab haveT

    A0 K

    IE. (hat are theyT

    A0R $loc s!. device devdrv, or remote S to be mounted.One can use LA$L too which !oints to a hardware !artition.

    R t !oint for the S

    R "y!e of SR ount o!tions associated with the SR /um! detailsR fsc

    IF. "he fifth field of :etc:fstab contains mount o!tions associated with theS vi>. extC.(hat does defaults meanT

    A0 rw,suid,dev,exec,auto,nouser,async

    KG. x!lain them

    K1. 2ow would you remount all the S's in :etc:fstab w:o rebootingT

    A0 mount 3a

    K;. $y default, can a user mount a cdromT

    A0 Hes

    KC. 2ow would you disallow thisT

    A0 "he fifth field of :etc:fstab for cdrom contains noauto,owner.6hange to owner to noowner#

    KD. (hat is a synonym for ownerT

    A0 user nouser

    KI. foo mounts a cdrom and logs outT 6an bar log in and use his own cdromT

    CG

  • 7/23/2019 Linux Interview1

    31/39

    A0 4o. 2e will have to unmount foo's cdrom first, for which he has no!ermission.

    KK. So how would you hel! bar#

    A0 4o !roblem. 6hange owner to users#

    KB. Hou just said that owner and user and synonymous# 6an % use 'owners' above T

    A0 4o # (ill not wor#

    KE. "he fifth field of :etc:fstab for cdrom contains noauto,owner.%s it a good idea to change the noauto to autoT

    A0 4o. %f you forget to have a 6/ in the drive on boottime, system could hang#

    KF. Are there any ?U% tools to configure a 4S serverT

    A0 Hes. redhat3config3nfs.

    BG. % tried it but it is not woringT 2el! me.

    A0 "he file :etc:ex!orts must be missing. %t must, at the very least,be touched#

    ] (hich of the following !acages must be installed to host an 4S serverT a. nfsdb. nfsd3clientsc. netfs ----

    d. !ortma! -----

    ]. (hich daemon:s should be started to enable an 4S serverTA )ortma! , nfsd

    ]. (hat !ort does 4S useTA. ;GDF

    ]. /is!lay a list of 4S shares from a client if the server isshiva.bom.labs.net

    Ans 0 showmount Me shiva.bom.labs.net

    ]. 2ow does one chec the status of a 4S serverTA. showmount Me shiva.bom.labs.net

    ]. (hich file is configured on the 4S server to facilitate sharing acrossa 4etworT

    A. :etc:ex!orts

    ]. 2ow does one refresh 4S sharesTA. ex!ortfs 3r

    C1

  • 7/23/2019 Linux Interview1

    32/39

    ]. 2ow many columns does :etc:fstab haveTA. K feilds

    ]. (hich of the following lines would wor in :etc:ex!ortsTA. :root 1F;.1KE.G.G:;II.;II.;II.G

  • 7/23/2019 Linux Interview1

    33/39

    -irewall /IPTABLES0

    (hat is /\(hat is $astion 2ost(hat do you now about irewallsT

    Printin&

    What is the lp command?

    7ow can you find out the status of your print =ob?

    What command would you enter to cancel a print =ob

    7ow do ) install a new printer?

    l!admin, :etc:!rintca!7ow do ) setup a printer?l!admin, !rintca!, H(*

    S1ell Pr%&rammin&

    (rite a scri!t to convert all /OS style bacslashes to U4%5 style slashes in a list of files.

    2ow do % test for the !resence of a file in $ourne ShellT test 3f^^^ %n a shell scri!t, how do % !rint the scri!ts argumentsT W WR or W1..W;..^^^ 2ow do you mae a shell3scri!t executableTchmod ^^^ scri!t^^^ (hat is the difference between ' and @T )rotect, )rocess and ?rou!^^^ 2ow do % connect !rocesses, so stdout of one becomes stdin of anotherT !i!es^^^ 2ow do % redirect stderr under a $ourne ShellT ;

    ^^^ 2ow do % determine the home directory of a user in a shell scri!tT W2O, `, :etc:!asswd^^^ (hat is a regular ex!ressionT !attern matching language^^^ x!lain shell job control. fg,bg,_,P\^^^ (hats the differences between a $ourne and 63ShellT startu! file, scri!t syntax, etc..^^^ 2ow are new !rocesses createdT for:exec

    Hou have ;G servers that need to be u!dated named serverG1,serverG;...server;G. (rite a bash scri!t tou!date all the com!uters, assuming they all use ssh, with the account bo>o.Ans0

    N#:bin:bash

    user-@bo>o@Xu!datecmd-@ls 3l@X N !ut in r!m command hereerrorfile-@u!datelog@Xfor i in se+ 3w ;Gdo ssh @WZuser[serverWi@ Wu!datecmd echo @rror on server Wi Werrorfile@Xdone

    "he command se+ 3w ;G !ads with the necessary >eros

  • 7/23/2019 Linux Interview1

    34/39

    "he executes only the left side on success. 2owever, if the ssh fails, the right side is executed and anerror message to !i!ed to the file.

    2ow do you !ass and use a command variable to an aw scri!tT

    2ow can you easily !rint +uotes in an aw scri!tT U sing a sed scri!t !rint only thedata between @start.....:start@ in a file.

    2ow do you create a 6 lie for loo! in $ashT

    2ow do you find the length of an array in bashT

    Hou have ;G servers that need to be u!dated namedAns0Hours is woefully un!ortable. or starters, you can't rely on bash.Second, you can't rely on ?4U3s!ecific tools lie se+.

    for i in se+ 3w ;G

    %f you're using bash, why add an extra shell invocation hereT

    for i in ZG1..;G[ should get the same effect in recent versions of bash;.

    (rite a regular ex!ression e, file location, ownershi!, etc. )lus, it contains a !ointerto the first few blocs of data in the file.

    What is a superblock and what kind of data is in it?

    CD

  • 7/23/2019 Linux Interview1

    35/39

    Any file system broen enough to need the alternate su!erbloc is too broen to use... after all, that is whyyou have bacu!s.

    Any Unix today that re+uires one to !lay with the file system at the su!erbloc level is also too broen touse in any ind of !roduction environment. %t is sim!ly not @!roduction +uality,@ let alone @state of theart.@

    All that ind of stuff went away with the develo!ment of fsc some ;G years ago.

    (hile !laying with su!erblocs and file system structure may be fine on a hobby system, a commercialsystem cannot afford the downtime, the introduced lac of reliability associated with !laying with the filesystem on the bit level or the time while someone !lays 33 that time is better s!ent on recovery which youare willing to @bet the com!any on.@

    3)(0

    'sing the find command how do you find directory names that do not contain a

    particular file?

    'sing the find command4 how do you find all files with the immunitable attribute set?

    Write a command to find all of the files which have been accessed within the last DN days.

    find : 3ty!e f 3atime 3CG /ecember.files"his command will find all the files under root, which is Y:, with file ty!e is file. Y3atime 3CG will give allthe files accessed less than CG days ago. And the out!ut will !ut into a file call /ecember.files.

    (E$

    (hat is the difference between %) as+ and )roxyT

    SS7

    7ow would ) configure sshd to not ask for a password when connecting with a given user from a

    certain host?

    "he best solution for this is to create a /SA ey which can be used to authori>e you when you log into thecom!uter. "his is done in two ste!s, 1= 6reate the ey, ;= "ransfer the !ublic !art of the ey to the server.

    Ste! one0On the machine which you want to connect from, execute the following command0

    ssh3eygen 3b BKE 3d 3f `:.ssh:id^dsa 3) @@

    "his will create two files under .ssh: in your homedirectory. "hey will be called 'id^dsa' and 'id^dsa.!ub'which contains the !ublic

  • 7/23/2019 Linux Interview1

    36/39

    %n reality, you should just find a way to transfer your '.ssh:id^dsa.!ub' file to the remote machine, renameit to 'authori>ed^eys;' and !lace it under '.ssh:' in your homedirectory. Also, if you want to add moreeys to the same account on a server, you'll just a!!end the data in your new id^dsa.!ub file to the.ssh:authori>ed^eys; file on the server.

    4ote0 "his solution is based on the ssh v;.G !rotocol since it's more secure than v1.x in general. "herefor,

    if your ssh client su!!orts v1.x and the server is configured to try that version first, you'll !robably have totell the client to use v;.G, or you will get a !assword +uestion anyway. e su!!orted by linux1G= what is &A%/ 33311= nimum nos. of 2// re+ired for &A%/ G,1,I _ G11;= what is OS hardening1C= what is aw1D= what is sticy bit1I= is use of setuid _ setgid1K= what u will do if any !artition is full

    1B=

    Gaximum (umber of "artitions)lease note that under Linux maximum KC %/ !artitions can be created and 1I S6S% !artitions can becreated !er dis.

    Booting procedure & what is kernel

    1. A boot loader fnds the kernel image on the disk, loads it into memory, and starts it.2. The kernel initializes the devices and its drivers.

    3. The kernel mounts the root fle system.4. The kernel starts a program called init.. !nit sets the rest o" the processes in motion.#. The init program reads it$s confguration "rom the inittab. This fle is %here run levelscome into e&istence.'. (unlevel )cripts *+etc+rc.d+. The link names %ill begin %ith an -action %hich %ill eitherbe an $)$ or a $/$ that %ill signi"y %hether to $start$ or $kill$ the daemon.0. rc.sysinit.)tart the net%ork service.remount the flesystem in read%rite mode.. rc.local . )cript %ill be e&ecuting at the end.

    CK

  • 7/23/2019 Linux Interview1

    37/39

    Diference between LILO and Grub

    !5 has no interactive command inter"ace, %hereas 6(78 does. !5 does not support booting "rom a net%ork, %hereas 6(78 does. !5 stores in"ormation regarding the location o" the operating systems it can to loadphysically on the 98(. !" you change your !5 confg fle, you have to re%rite the !5stage one boot loader to the 98(. :ompared %ith 6(78, this is a much more risky optionsince a misconfgured 98( could leave the system unbootable. ;ith 6(78, i" theconfguration fle is confgured incorrectly, it %ill simply de"ault to the 6(78 commandlineinter"ace.

    Diferences between Ext2,Ext and Ext! "le s#ste$s in linux%

    E'2 < =&t2 %as the standard fle system "or linu& until the introduction o" e&t3.!t %asintroduced %ith the 1.> kernel in 13.=&t2 is ?e&ible,can handle fle system up to 4 T8,andsupports long flenames up to 1>12 characters,it has sparse super blocks "eature %hichincrease fle system per"ormance.!n case any user processes fll up a fle system,e&t2normally reserves about @ o" disk blocks "or e&clusive use by root so that root can easilyrecover "rom that situation.o% our rescue diskettes use e&t2 instead o" mini&.

    E' < =&t3 *=&tended 3 fle system provides all the "eatures o" e&t2,and also "eaturesBournaling and back%ard compatibility %ith e&t2.The back%ard compatibility enables you tostill run kernals that are only e&t2a%are %ith e&t3 partitions.%e can also use all o" the e&t2fle system tuning,repair and recovery tools %ith e&t3 also you can upgrade an e&t2 flesystem to an e&t3 fle system %ithout losing any o" your data.=&t3Cs Bournaling "eature speeds up the amount o" time it takes to bring the fle system backto a sane state i" itCs not been cleanly unmounted *that is,in the event o" a po%er outage ora system crash. 7nder e&t2,%hen a fle system is uncleanly mounted ,the %hole fle systemmust be checked.This takes a long time on large fle systems.5n an e&t3 system ,thesystem keeps a record o" uncommitted fle transactions and applies only those transactions%hen the system is brought back up.)o a complete system check is not reDuired and thesystem %ill come back up much "aster.

    A cleanly unmounted e&t3 fle system can be mounted and used as an e&t2 fle system,thiscapability can come in handy i" you need to revert back to an older kernel that is not a%areo" e&t3.The kernel sees the e&t3 flesystem as an e&t2 fle system.E'!< =&t4 is part o" the inu& 2.#.20 kernel,=&t4 is the evolution o" the most used inu&fle system, =&t3. !n many %ays, =&t4 is a deeper improvement over =&t3 than =&t3 %asover =&t2. =&t3 %as mostly about adding Bournaling to =&t2, but =&t4 modifes importantdata structures o" the fle system such as the ones destined to store the fle data. The resultis a flesystem %ith an improved design, better per"ormance, reliability and "eatures.Eeatures o" =&t4 fle system