Thursday, January 24, 2008

Solaris Interview Questions

Another post in same series

1) What files control user administration?
A) /etc/passwd file: 7 Fields: loginid:x:userid:groupid:
comment:homedir:shell
/etc/shadow: 9 Fields: loginid:password:lastchng:min:
max:warn:inactive:expire
/etc/group : 4 Fields : groupname:password:groupid:
username list)

2) What does the "pwconv" command do?
A) It updates the /etc/shadow file with information from /etc/passwd file.

3) Where are the failed login attemps to system logged?
A) /var/adm/loginlog (We need to create this file as it does not exist by default)

4) Which command shows the users currently logged in to system?
A) who ( It reads the information from /var/adm/utmpx file)

5) Which command will show detailed information about a user?
A) finger –m


6) Which command displays all login and logouts?
A) last (It reads the information from /var/adm/wtmpx file)

7) What is the "StickyBit" file permission?
A) Sticky Bit permission protects the file within a public writable directory.
File set with sticky bit will not allow any user to delete the file except the
Owner of file, owner of the group or the root user.

8) How is ACL (Access Control Lists) implemented?
A) 8.1) "getfacl"command : To display an ACL on file.
Syntax : getfacl


8.2) setfacl command : To set the ACL on file
Syntax : setfacl


8.3) setfacl –m command : To modify ACL entries
Syntax : setfacl –m


8.4) setfacl –s command : Remove old ACL entries and replace with new one.
Syntax : setfacl –s


8.5) setfacl –d command : Delete ACL entry
Syntax : setfacl –d


9) Imp "root(/)" subdirectories and their purpose :
9.1) / : Root of overall file system.
9.2) /bin : Symbolic link to /usr/bin. Stores standard system commands and binary files.
9.3) /dev : Primary location for "logical" device names
9.4) /devices : Primary location for "physical" device names
9.5) /etc : Contains host specific system admin config files
9.6) /export : Default directory for commonly shared filesystems.
9.7) /home : Default directory / mount point for user's home directory
9.8) /kernel : Directory of platform independent loadable kernel file
9.9) /mnt : Temporary mount point for file systems
9.10) /opt : Default directory for add on packages
9.11) /sbin : Executables used in booting process and file recovery
9.12) /tmp : Temporary files
9.13) /usr : Mount point for /usr file system
9.14) /var : Directory for varying files, temporary logging or status files

10) What are the different disk slices?
Slice Name Function
0 / Root's system files
1 swap Swap area
2 Entire Disk
5 /opt Optional Software
6 /usr System Exe's
7 /export/home User's file and directories

11) Which command displays the system configuration information?
A) prtconf

12) Which command is used to configure newly attached hardware ?
A) devfsadm –c where

13) What are the different types of "file systems" in Solaris?
A) There are 3 Types of file system :
13.A.1) Disk based : ufs (standard unix), hsfs (cd-rom), pcfs (Floppy)
Or udf (DVD and CD Rom)
13.A.2) Distributed : NFS (enables sharing of files between many types of n/w)
13.A.3) Pseudo : tmpfs (temporary), swapfs , fdfs, procfs

14) What is a "boot block"?
A) The bootstrap program (bootblk) is found in the next 15 disk sectors. Only the "root" file system has an active boot block, although the space is allocated for boot block at the beginning of each file system.

15) What is "superblock"?
A) The file system is determined by its superblock. It is contained in the 16 disk sectors following the boot block. It contains :
· No. of data blocks
· No.of cylinder groups
· Size of data block fragment
· Description of hardware
· Name of mount point
· File system state flag ( clean , stable , active , logging or unknown)

16) How will you repair the main superblock if it gets corrupted?
A) Every file system has backup superblock at block no.32, which can be given to fsck to repair the main superblock.
# fsck –o b=32 /dev/rdsk/c0t0d0s0

17) How to create new file systems ?
A) newfs /dev/rdsk/c0t0d0s0

18) How will you restore /etc/vfstab file if it gets corrupted?
A) Step 1 : Insert Solaris CD 1 of 2
Step 2 : Go to single user mode : ok boot cdrom –s
Step 3 : Run "fsck" on /(root) partition : # fsck /dev/rdsk/c0t0d0s0
Step 4 : Mount /(root) file system on /a directory to gain access to file system
# mount /dev/dsk/c0t0d0s0 /a
Step 5 : Set & export TERM variable
# TERM=sun
# export TERM
Step 6 : Edit /etc/vfstab file and remove the incorrect entry : # vi /a/etc/vfstab
Step 7 : Unmount the file system : # cd / ; # umount /a and reboot the system.

19) How will you share user's home directory?
A) Step 1 : Login as root and verify mountd daemon is running
# ps –ef grep mountd
Step 2 : If the daemon is not running start it :
# /etc/init.d/nfs.server start
Step 3 : List all shared filesystems
# share
Step 4 : Edit the /etc/dfs/dfstab file and add :
# share –F nfs /export/home
Step 5 : Share the file systems in the /etc/dfs/dfstab file :
# shareall –F nfs
Step 6 : Verify that the home directory is shared.
# share

20) What does /etc/inittab file contain ?
A) The /etc/inittab contains the systems default run level, processes to start/monitor
or restart. It also contains the actions to be taken when run level changes.
/etc/inittab file is in foll format :- id:rstate:action:process

21) How will you use "shutdown" command?
A) # shutdown –i0 –g300 –y

22) How will you check the OBP version of your system ?
A) Use " banner" command at the ok prompt

23) Explain the Solaris Boot process?
A) 23.1 ) Boot Prom Phase : Runs POST to verify system hardware and memory Loads "bootblk" primary boot program.
23.2) Boot Program Phase : "bootblk" loads the finds "ufsboot" and loads it in memory.ufsboot loads the kernel.
23.3) Kernel Initialization Phase : Loads modules using "ufsboot"
Creates user processes and starts /sbin/init process.
23.4) Initialization Phase : Starts "rc" scripts. These scripts check & mounts file System, starts various processes and perform system maintanence tasks

24) Backup And Restore :
Full backup : # ufsdump 0uf /dev/rmt/0 /
Where 0 à indicates full backup f à Path of the backup device u à update the dumpdates file.
Restore : # ufsrestore if /dev/rmt/0

25) How to temporary disable user's login.
A) Log in as "root"
B) Create /etc/nologin file
# vi /etc/nologin
C) Include a message
D) Close and Save the file.

26) What does 'Probe' command do?
A) probe-scsi-all à list all internal and external scsi devices
B) probe-ide-all à List all ide devices

27) How to find whether a system is configured for 32-bit or 64-bit?
A) # isainfo -v

28) How to activate Ethernet card ?
A) # ifconfig qfe0 plumb

29) How will you assign ip address to system?
A) # ifconfig qfe0 192.168.0.1 netmask 255.255.255.0 up

30) How will you check current ip configuration?
A) # ifconfig –a

31) How will you set a default router ?
A) # /etc/defaultrouter

32) How to remove all current routes and assign 192.168.1.100 as default router?
A) # route flush
# route add default 192.168.1.100

33) How to change the network settings ?
A) # sys-unconfig

34) What all does the NVRAM store?
A) Ethernet Address / Host ID / Time of Day (TOD) clock and EEPROM Parameters

35) Where are all the port numbers stored?
A) Port numbers are stored in /etc/services

36) Where are eeprom file stored ?
A) /usr/sbin/eeprom

37) Some important NIS commands :
1) # ypcat hosts à Prints info from hosts database
2) # ypmatch host1 hosts à Match individual host entries
3) # ypmatch user1 passwd
4) # ypwhich à Returns NIS master server.

38) Controlling the tape drive ?
1) mt –f /dev/rmt/0n à 'n' indicates no rewind.

39) What are the network utilities ?
1) snoop à To capture network packets & display contents
2) netstat –i à Displays state of Ethernet address
3) ndd command à Set & examine kernel parameters namely TCP/IP drivers.

40) Network Configuration :
1) /etc/resolv.conf : Contains Internet domain name, name server and search order.
2) /etc/nsswitch.conf : Specifies information source from files, NIS, NIS+ or DNS
3) /etc/hostname.[int](hme0eri0
le0] : IP v4 host
4) /etc/nodename : IP v6 host
5) /etc/inet/hosts : Host namefile (/etc/host links to this file)
6) /etc/inet/netmasks : TCP/IP subnet router
7) /etc/inet/protocols : Network protocols
8) /etc/inet/services : Network service name & port numbers
9) /etc/notrouter : Create this file to prevent in.routed or in.rdiscd from starting at boot time
10) /etc/inet/inetd.conf : Internet super daemon config file
11) To change hostname / ip address :

/etc/hostname.{int}(hme0le0)
/etc/nodename
/etc/inet/hosts
/etc/net/*/hosts
/etc/defaultrouter
/etc/resolv.conf

41) How to configure interfaces at boot time>
A) /etc/rcS.d/s30network.sh file à This script is run each time system is booted. It uses ifconfig utility to configure each interface with IP add & other network info.It searches for files called : hostname.xxn in /etc where xx à int type & nà instance of interface

No comments: