All questions can be answered in the context of any version of UNIX (except for the Solaris and FreeBSD sections obviously!). Indicating which version of UNIX you refer to in your answer is preferred but not required. Negative marking applies throughout for answers that are clearly incorrect or demonstrate incompetence.
Humourous answers while appreciated gain no extra marks. Keep answers short and concise - don’t waste time writing when one or two word answers will suffice.
Best of luck!
- cns, dizer, pixies
- You must be mesg n for duration of test. Any attempt to communicate with other users will result in immediate failure.
- You may only refer to system documentation (man & info pages) for help, i.e. no web access!
- You are free to use any shell or scripting language to write the scripts. Only system commands may be used, your own or other user scripts may not be referred to. Basically: no cheating!
- Make a directory ~/admin_test and place scripts in there. Name each script by its question number.
Here we go..
Write a script to monitor a log file for a line of the form:
2003-03-03 WARNING! **n** monkies are eating our **hardware item**!
n will be a number (5, 10, etc), hardware item will be a string containing only lower case letters and spaces. The date at the start can be any date, not always the 3rd March :-)
When this line appears, the script should send a mail to a list of people supplied as an argument, with the subject “Monkey alert! n consuming hardware item!”. The script should send a mail for all such matching lines not just the first and will be run as follows:
% ./script email@example.com firstname.lastname@example.org
If your script fails, the death of thousands between the jaws of monkies will be on your conscience.
Write a script to rotate all the files in a particular directory, to be run as follows:
% ./script /directory /output
/directoryis the path to the directory containing all the log files and
/outputis the path to the directory where the log files are to be placed like so:
Where YYYY, MM and DD are the current year, month and day respectively and file.gz is the gzipped version of the original log file.
Write a script to kill off all processes between a given range of PIDs (inclusive) that have an RSS value over a given size, to be run as follows:
# ./script 100 1000 2000
This should kill all processes with a PID between 100 and 1000 inclusive that have a RSS greater than or equal to 2000KB.
- Name the important difference between the killall command on Linux and on Solaris. (1 mark)
- Discuss how you would go about adding a new disk to a Solaris machine. (3 marks)
- Discuss the purpose and usage of the dumpadm command. (2 marks)
- On a Solaris system, why is /usr/bin/ps not setuid root? (2 marks)
- Where is the kernel stored on a Solaris machine? (1 mark)
- How would you add a package to a solaris system, and list the packages already installed? (2 marks)
- What is an ACL and how would you set one? thehand is a popular redbrick utility for blocking particular users from writing to your terminal. In the context of ACLs explain how it works. (3 marks)
- What command can provide details on CPU temperature, power supply status, memory bank status (etc)? (2 marks)
- Which Sun website contains patches, bug reports, etc? (1 mark)
- Describe what is meant by filesystem logging? (2 marks)
- When shutting a Solaris system down what is the difference between these programs:
- halt(2 marks)
- For each of the following commands specify if you should use the raw disk device, or not, or if it doesn’t matter.
- mount(3 x 1 marks)
- Linux uses the ext2 filesystem extensively, what does Solaris normally use? (1 mark)
- What does the runacct command do? (2 marks)
- What are /etc/system and /etc/default/ used for? (2 marks)
- You’re standing in front of Prodigy, which has a Sun Keyboard attached to it. How can you drop to the OBP immediately? (1 mark)
- Identify what type of devices ‘da0’, ‘sa0’ and ‘ad0’ refer to. (3 marks)
- The kernel on your system is missing and there are no backup copies. You do however have a bootable CD with FreeBSD on it, how do you boot using the CD’s kernel but using the root filesystem of your hard disk? (2 marks)
- What is the latest release version of FreeBSD? (2 marks)
- Briefly mention what the following commands are used for:
- vinum(4 x 2 marks)
- You want to run some custom commands when the system is shutdown, which file do you place these in? (2 marks)
- Describe how to install an application from the ports system? (2 marks)
- Descibe what a disk slice is and its advantages over normal partitioning schemes? (4 marks)
- If you wanted to pre-load modules before the kernel is loaded, what file would you edit? (2 marks)
- How would you partition and format a new disk in a machine with a FAT filesystem and mount it as /dos ? (4 marks)
- What is generally regarded as the quickest method for updating source and port trees ? (1 mark)
- We’ll start with an easy one. What’s the difference between /dev/rdsk/c0t0d0s0 and /dev/dsk/c0t0d0s0? (Explanation, not just a few words) (3 marks)
You’re looking at a directory listing, and you see the following items (from ls -l) (7 marks):
1: drwx------+ 3 pixies committe 512 Feb 4 2002 cia 2: -rw------- 1 pixies committe 9319 Jul 11 2001 cv.pdf 3: prw------- 1 root root 0 Mar 27 15:55 queue
- What file type are 1 and 2? (1 mark)
- What does the ‘+’ in item 1 mean? How could you find out more about this? (2 marks)
- Why does pixies have a file owned by root in his directory? (any plausible explanation) (1 mark)
- What file type is item 3? How could one make such a file? What could it be used for? (3 marks)
You’ve obtained the following output from a system command:
/ on /dev/md/dsk/d0 read/write/setuid/intr/largefiles/logging/onerror=panic/dev=1540000 on Wed Dec 11 11:23:11 2002 /proc on /proc read/write/setuid/dev=3940000 on Wed Dec 11 11:23:04 2002 /dev/fd on fd read/write/setuid/dev=3a00000 on Wed Dec 11 11:23:16 2002 /etc/mnttab on mnttab read/write/setuid/dev=3b00000 on Wed Dec 11 11:23:21 2002 /var on /dev/md/dsk/d3 read/write/setuid/intr/largefiles/logging/onerror=panic/dev=1540003 on Wed Dec 11 11:23:43 2002 /var/run on swap read/write/nosuid/size=8M/dev=1 on Wed Dec 11 11:23:43 2002 /tmp on swap read/write/nosuid/size=256m/dev=2 on Wed Dec 11 11:24:12 2002 /local on /dev/md/dsk/d2 read/write/setuid/intr/largefiles/logging/onerror=panic/dev=1540002 on Wed Dec 11 11:24:12 2002 /home on /dev/md/dsk/d4 read/write/nosuid/intr/largefiles/logging/quota/onerror=panic/dev=1540004 on Wed Dec 11 11:24:12 2002 /snapshot/home on /dev/fssnap/0 read only/nosuid/intr/largefiles/logging/onerror=panic/dev=f00000 on Sun Mar 23 03:07:17 2003
- What command gives you this information? Also accepted is the file containing it. (1 mark)
- What do the following represent:
- The first item in the output? (e.g. /, /tmp)?
- The second item? (e.g. /dev/md/dsk/d0, /proc)?(4 x 1 marks)
- What does the ‘md’ in lines such as ‘/dev/md/dsk/d0’ mean? Name one command related to it. (2 marks)
- How would I prevent people executing files located in /home? (1 mark)
- Due to a disk problem, / has been mounted readonly. I need to change root’s password so I can log in, as I don’t know the machine. What should I do? (2 marks)
- What tool can I use to check a filesystem for errors? (1 mark)
- You have a corrupt superblock on an old disk. You know it was formatted using default values. How can you determine the locations of backup superblocks, with access to the tools used to format it? (2 marks)
- What are these filesystems usually used for?
- /dev(2 x 1 marks)
- You have just added a new drive to a system running your favourite UNIX-a-like OS. It shows up in your /dev directory. Describe the steps required to set it up for use as your /mp3s directory. (5 marks).
- Briefly describe RAID. (2 marks)
- Describe 3 advantages of RAID. (3x2 marks)
- What are the three most common RAID levels. (2 marks)
- Redbrick buys a new server for production use, what RAID level would you use for the boot device? Why? (3 marks)
- What’s the difference between RAID 1+0 and RAID 0+1? (1 mark)
- Name 3 advantages of SCSI over IDE. (3x2 marks)
- You attach a new SCSI disk to a machine, but it doesn’t work. Name two things to check. (2x2 marks)
- Someone has donated a SparcStation, you have no Sun monitor or 13w3 convertor. Describe a means through which you could log into the machine? (2 marks)
- A machine has two hard-disks on the first IDE channel. Name two ways of changing which is the master and which is the slave. (2x2 marks)
- You want to scan the Redbrick network for unauthorised connections. Name a tool you would use to do this. (2 marks)
- What does SOA stand for? (1 marks)
- Name a way to list all open TCP connections on a machine. (1 mark)
- How would you retrieve the mail servers for the redbrick.dcu.ie domain? (2 marks)
- Name two differences between a switch and a hub. (2 x 2 marks)
- There are two network cards in one machine, but one starts malfunctioning. How would you go about manually configuring the second to take the place of the first. You are at the console of the machine. (2 marks)
- Explain the concept of NAT? (3 marks)
- Name a disadvantage of NAT. (1 marks)
You connect a machine with one NIC to the RedBrick subnet (184.108.40.206/24) where the gateway is 220.127.116.11. Output from ifconfig:
eth0 Link encap:Ethernet HWaddr 00:00:3B:E2:C9:DF inet addr:18.104.22.168 Bcast:22.214.171.124 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:13 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:11
And the routing details are:
Destination Gateway Genmask Flags MSS Window irtt Iface 126.96.36.199 0.0.0.0 255.255.255.0 U 40 0 0 eth0
Identify the errors in the output and suggest a means of rectifing each one.
- Ftp on Prodigy was recently removed from inetd and made standalone. Explain what is meant by inetd and standalone and possible reasons for this change. (3 marks)
- You start a daemon from the command line, but it complains “Cannot bind to port”. Suggest two possible causes for this. (2 marks)
Note: This section has quite a high answer to marks ratio. It’s acceptable to resort to bullet points, if you feel they answer the question sufficiently. Not all questions are purely technical.
- An oldie, but a goodie: why is telnet considered insecure, if we assume that the telnet server and client are written without any security holes? Some detail required. (2 marks)
- You have 5 seconds at an unattended root shell (and can type at a rate of at least 8 characters a second). Using only the /tmp directory and basic commands, describe how you could give yourself a back door on the system. You have an unprivileged shell account already. (2 marks).
- Describe, in general terms, the function of a one-way/hash/signature function such as MD5 or SHA1. Explain how this can be used by tools such as Tripwire to ensure your files are safe. (2 marks)
- A guy comes up to you in the labs looking frantic. “Jaysus!” (he says) “I’ve just lost me redbrick password, and me project is in it! I’m cleverguy@redbrick, could you reset it to ‘pleasegodidontwannafail’?” What do you do? (2 marks)
- What is a firewall? Describe roughly how it works, making reference to TCP/IP, port numbers and protocol numbers, and why this is beneficial. (3 marks)
- Discuss, very briefly: “UNIX is immune to viruses and worms”. (2 marks)
- What is wrong with the traditional UNIX security model regarding users and files? i.e. how is it flawed. (2 marks)
- RBAC is “Role Based Access Control” for Solaris. What does this mean? (2 marks)
- Somebody asks you “Hey, 188.8.131.52 is a RedBrick IP, what’s that machine do?”. Your head explodes in panic, as that IP isn’t in use by RedBrick. After your head unexplodes, how do you proceed? Assume you can track down the owner of the machine. (3 marks)
- You have a program that requires “libfoo” and is dynamically linked against it. However, there are two different versions of libfoo, one in /usr/local/lib and one in /usr/local/foo/lib. How do you:
- Find out which library the program would normally use when run from your shell? (2 marks)
- Force the program to use the library verison in /usr/local/foo/lib when run from the shell? (2 marks)
- What is the mechanism that a process (e.g. a shell) would use to allow the suspension and resumation of other processes? (2 marks)
- Give 1 advantage of using dump and 1 advantage of using tar for making backups. (2 marks)
- You have downloaded a compressed tarball, but don’t know what program was used to compress it. Give 2 methods for determining this. (2 marks)
- Name the 2 different ways in which at jobs are typically automatically launched by the system? (2 marks)
- Name the command and describe its use on how to remove jobs from the ‘at’ scheduler queue? (2 marks)
- What is a Mail Transfer Agent and name the one used on prodigy. (2 marks)
- What is a Mail Delivery Agent and name the one used on prodigy. (2 marks)
- What is the mt command used for? Give an example of its use. (3 marks)
- The tape device ‘st0’ has three forms: st0, rst0 and nrst0, what is the difference between these? (note that his applies to many UNIXes despite different names for actual tape device) (3 marks)
- You accidentally cat a binary file and it corrupts your terminal. Name 2 commands you would try to fix this? (4 marks)
- Where are C system header files usually located ? (2 marks)
- Do you prefer Vi or Emacs? (Vi = 0 marks, Emacs = -10 marks)
- What does this do?
- Rate these operating systems in order of preference:
- You’re stressed out with project work, your latest program doesn’t work, you’ve just spent an hour and a half running around DCU trying to get a working printer, you have to write an admin test and someone heys you and asks you for a Tomcat account. What do you do?
- Write this in hex.