This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Network Security: LAB1 Solution 1. What is the first process a typical Linux kernel starts? ‐ init process. 2. Linux Startup Procedure: • BIOS and Boot Manager: The BIOS performs a power‐on self test, conducts the initial detection and setup of hardware, and access bootable devices such as CD or hard drive. The Boot Manager such as GRUB loads the kernel and the initrd to memory and starts the kernel. Kernel: The kernel which is a link to /boot/vmlinuxz‐kernelversion, uncompresses itself and then organizes and takes control of the continued booting of the system. The kernel controls the entire system, managing hardware access and allocating CPU time and memory to programs. Initramfs (Initial RAM file system): It is a cpio archive that the kernel can load to RAM disk. It provides a minimal Linux environment that enables the execution of programs before the actual root file system is mounted. The initramfs must always provide an executable named init that should execute the actual init program on the root file system for the boot process to proceed. Init: After checking the partitions and mounting the root file system, the program init located in initramfs starts /sbin/init, which boots the system with all its programs and configurations. • • • 3. Find a file in the Linux box assign to you in ISIS that contains the string Hello CS6823 and report the command you used to find this file. ‐ Ans: Various ways you can identify the file. You can use recursive grep such as “ grep –r <string_name> <location> “ or you can also use find command such as “ find / |xagrs grep “Hello*” “ 4. Write a shell script to execute all executable files in the current directory and capture their output to the file “out.lab1” Ans: Various ways you can answer this question. One method would be: for file in `ls` // list the file in the current directory do if [ ‐x $file ] // “‐x” checks for executable permission for file. You also can use “test” Network Security: LAB1 Solution then ./$file >> out.lab1 fi done 5. Modify you Linux box’s startup such that it appends the current time and date to a file in the root’s directory. Ans: You can create a date script and make it executable. Copy the script into /etc/init.d directory. Then create a soft link using `ln –s` such as : `ln –s /etc/init.d/date.sh /etc/rc.d/rc5.d/S50date` in the run level script. When the system boots, it will create a file with date stamps. 6: What command would you use to see the processes that are running currently on your Linux system? Explain how you can kill (stop) a process. Ans: Various ways such as ps aux or top or prstat. To kill a process you can use kill command. 7: How do you setup variables in bash? How would you remove them without loggin out? Ans: You can use <variable name>=<value> and use unset command to remove the variable. All of you answered this question correctly. 8: Display last bootup time? Ans: You can use last command or who –b Question 9 and Question 10 all of you answered correctly. Therefore I did not post the solution for it. You can find the answers in Linux man pages. ☺ ...
View Full Document
This note was uploaded on 11/02/2010 for the course CS 393 taught by Professor Staff during the Spring '08 term at NYU Poly.
- Spring '08