40 Linux Interview Questions and Answers

Ace your homework & exams now with Quizwiz!

What is the name and path of the main system log?

By default, the main system log is '/var/log/messages'. This file contains all the messages and the script written by the user. By default all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to 'dmesg'. dmesg is a system file that is written upon system boot.

What is the difference between internal and external commands?

Internal commands are commands that are already loaded in the system. They can be executed any time and are independent. On the other hand, external commands are loaded when the user requests for them. Internal commands don't require a separate process to execute them. External commands will have an individual process. Internal commands are a part of the shell while external commands require a Path. If the files for the command are not present in the path, the external command won't execute. What is the difference between internal and external commands? - The commands that are directly executed by the shell are known as internal commands. No separate process is there to run these commands. - The commands that are executed by the kernel are knows as external commands. Each command has its unique process id.

What is LD_LIBRARY_PATH?

LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non standard library. It is also used for which directories to search. Path to search for directories needs to given. The variable can be set by using setenv—LD_LIBRARY_PATH--$PATH What is LD_LIBRARY_PATH? LD_LIBRARY_PATH is an environment variable. This is used to search for the shared objects / dynamic libraries by the operating system for extendable functionality at runtime.

How does the linux file system work?

Linux file structure is a tree like structure. It starts from the root directory, represented by '/', and then expands into sub-directories. All the partitions are under the root directory. If a partition is mounted (The mount point defines the place of a particular data set in the file system) anywhere apart from a "device", the system is not aware of the existence of that partition or device. Directories that are only one level below the root directory are often preceded by a slash, to indicate their position. Explain file system of linux. The root "/" filesystem, /usr filesystem, /var filesystem, /home filesystem, /proc filesystem. Root "/" file system: The kernel needs a root file system to mount at start up. The root file system is generally small and should not be changed often as it may interrupt in booting. The root directory usually does not have the critical files. Instead sub directories are created. E.g. /bin (commands needed during bootup), /etc (config files) , /lib(shared libraries). /usr filesystem: this file system is generally large as it contains the executable files to be shared amongst different machines. Files are usually the ones installed while installing Linux. This makes it possible to update the system from a new version of the distribution, or even a completely new distribution, without having to install all programs again. Sub directories include /bin, /include, /lib, /local (for local executables) /var filesystem: this file system is specific to local systems. It is called as var because the data keeps changing. The sub directories include /cache/man (A cache for man pages), /games (any variable data belong to games), /lib (files that change), /log (log from different programs), /tmp (for temporary files) /home filesystem: - this file system differs from host to host. User specific configuration files for applications are stored in the user's home directory in a file. UNIX creates directories for all users directory. E.g /home/my_name. Once the user is logged in ; he is placed in his home directory. /proc filesystem: this file system does not exist on the hard disk. It is created by the kernel in its memory to provide information about the system. This information is usually about the processes. Contains a hierarchy of special files which represent the current state of the kernel .Few of the Directories include /1 (directory with information about process num 1, where 1 is the identification number), /cpuinfo (information about cpu), /devices (information about devices installed), /filesystem (file systems configured), /net (information about network protocols), /mem (memory usage) How does the Linux file system work? - At the time of installation of Linux, a file system is assigned and persists in the hard disk. This file system structure resembles a tree. - A file can be a list of names and numbers or executable programs. Linux treats every program as a file. Linux treats directories and computer components also as files. - A file could be a list of names and numbers, a cheesecake recipe, or an executable program. But under Linux, everything is a file. In addition to data and executable files, Linux treats directories and even the various components of your computer as files. It could be a keyboard, console, and printer, RAM or ROM. These are referred as special files known as devices. These files are available in /dev directory. Linux performs the communication with these devices by simply reading from or writing to these special files.

What is Linux and why is it so popular?

Linux is an operating system that uses UNIX like Operating system. However, unlike UNIX, Linux is an open source and free software. Linux was originally created by Linus Torvalds and commonly used in servers. Popularity of Linux is because of the following reasons - It is free and open source. We can download Linux for free and customize it as per our needs. - It is very robust and adaptable. - Immense amount of libraries and utilities

What is the minimum number of partitions that you need to install Linux?

Minimum 2 partitions are needed for installing Linux. The one is "/ or root" which contains all the files and the other is swap. Linux file system is function specific which means that files and folders are organized according to their functionality. For example, all executables are in one folder, all devices in another, all libraries in another and so on. "/ or root" is the base of this file system. All the other folders are under this one. "/" can be consider as "C:". Swap is a partition that will be used as virtual memory. If there is no more available RAM a Linux computer will use an area of the hard disk, called swap, to temporarily store data. In other words it is a way of expanding your computers RAM.

What are the qualities of soft links?

a.) Soft link files have different inode numbers than source file b.) The soft link file will be of no use if original file is deleted. c.) Soft links are not updated d.) They can create links between directories e.) They can cross file system boundaries

Which commands are used to set a processor-intensive job to use less CPU time?

nice command is used for changing priority of the jobs. Syntax: nice [OPTION] [COMMAND [ARG]...] Range of priority goes from -20 (highest priority) to 19 (lowest). Priority is given to a job so that the most important job is executed first by the kernel and then the other least important jobs. This takes less CPU times as the jobs are scheduled and are given priorities so the CPU executes fast. The priority is given by numbers like -20 describe the highest priority and 19 describe the least priority.

How do you create a new user account?

useradd command is used for creating a new user account. When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line and the default values from the system. The new user account will be entered into the system files as needed and initial files copied, depending on the command line options. This command uses the system default as home directory. If -m option is given then the home directory is made.

How to change window manager by editing your home directory?

"/.xinitrc file" allows changing the window manager we want to use when logging into X from that account. The dot in the file name shows you that the file is a hidden file and doesn't show when you do a normal directory listing. For setting a window manager we have to save a command in this file. The syntax of command is: exec windowmanager. After this, save the file. Next time when you run a startx a new window manager will open and become default. The commands for starting some popular window managers and desktop environments are: -KDE = startkde -Gnome = gnome-session -Blackbox = blackbox -FVWM = fvwm -Window Maker = wmaker -IceWM = icewm

What is an INODE?

- It is a structure which has the description of all the files and pointers to the data blocks of files stored in it. - The information contained is file-size, access and modification time, permission and so on.

What does nslookup do? Explain its two modes.

- Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records, servers etc. It sends a domain name query packet to the corresponding DNS. - Nslookup has two modes: Interactive and non interactive. - Interactive mode allows the user to interact by querying information about different hosts and domains. - Non interactive mode is used to fetch information about the specified host or domain.

You are required to restore the file memo.ben. It was backed up in the tar file MyBackup.tar. Which command would you use to do it?

- The command that we would use is: tar xf MyBackup.tar memo.ben - It uses the x switch to extract a file.

You are logged on as a regular user. Without logging off and logging on as root, you are required to create a new user account immediately. How would you do it?

- This can be achieved by issuing the su command. - This will prompt you for the password of the root account. - Providing the password, logs you in as root. Now, you can perform any administrative duties.

What is partial backup?

- When you select only a portion of your file hierarchy or a single partition to back up, it is called partial backup.

Which account is created on Linux installation?

- With the installation of Linux, a super user account is created called as 'root'. - The syslogd daemon tracks the system information and saves it to specified log files.

What is the fastest way to enter a series of commands from the command-line?

- Write the commands, each separated by a semi-colon. Press enter after the last command. - The semi-colon would inform the shell that multiple commands are being entered at the command line, to be executed serially.

Which command would you use if you want to remove the password assigned to a group?

- gpasswd - r removes the password from the group. - Here, the gpasswd changes the password of the group and when it is accompanied by -r, the password gets removed.

Which file would you examine to determine the levels of messages written to system log files?

- kernel.h

What are Pipes? Explain use of pipes.

A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin) to another. UNIX shell has a special syntax for creation of pipelines. The commands are written in sequence separated by |. Different filters are used for Pipes like AWK, GREP. e.g. sort file | lpr ( sort the file and send it to printer) Uses of Pipe - Several powerful functions can be in a single statement - Streams of processes can be redirected to user specified locations using > What are Pipes? Explain use of pipes. Pipe is a symbol used to provide output of one command as input to another command. The output of the command to the left of the pipe is sent as input to the command to the right of the pipe. The symbol is |. For example: $ cat apple.txt | wc In the above example the output of apple.txt file will be sent as input for wc command which counts the no. of words in a file. The file for which the no. of words counts is the file apple.txt. Pipes are useful to chain up several programs, so that multiple commands can execute at once without using a shell script.

What is Stateless Linux server? What features does it offer?

A stateless Linux server is a centralized server in which no state exists on the single workstations. There may be scenarios when a state of a partilcuar system is meaningful (A snap shot is taken then) and the user wants all the other machines to be in that state. This is where the stateless Linux server comes into picture. Features: - It stores the prototypes of every machine - It stores snapshots taken for those systems - It stores home directories for those systems - Uses LDAP containing information of all systems to assist in finding out which snapshot (of state) should be running on which system. What is Stateless Linux server? What features does it offer? Stateless linux is a way how a system is to run and be managed. Being a stateless system, a system should be able to be replaced at any time with or without local storage media. In case of hard drive crash, the command resync can be used to a new drive. If server goes offline, a new virtual instance that is running the OS image off of the network storage.

What is Bash Shell?

Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific feature will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It supports regular and expressions. When bash script starts, it executes commands of different scripts. What is Bash Shell? Bash stands for "Bourne Again Shell". A shell is the user interface. Bash is more convenient shell for users among others. The scripts written in Bash are portable among machines, distributions and even operating systems.

How do I send email with linux?

Email can be sent in Linux using the mail command. Mail [options] [users] Options include: -s for subject, -c for carbon copy, -b for blind carbon copy E.g. mail user_name -s "hello" How do I send email with Linux? Linux supports to work with sending mails using a set of commands called as mail commands. The command to send email is 'mail'. The 'mail' command is used to send and receive emails. Syntax: mail [options] [users] Options are: -s,-c,-b Where -s for subject, -c for copy and -b for blind carbon copy Ex: mail username -s "Reports are needed" It prompts displays the subject as "Reports are needed". Similarly if -c and -b is given the mail will be sent to the corresponding recipients

What is the file server in Linux server?

File server is used for file sharing. It enables the processes required fro sharing. All the files can be stored at a centralized location. Linux uses Samba to view the files on the server. Files on this server are backed up on a regular basis. Rights can be also assigned for the files on a file server. What is the file server in Linux server? A file server is dedicated for persisting files in a location from which the networked systems can access. Certain access privileges can be set for files. Linux has software named as 'samba' which allows the files to be shared, viewed and edited on any remote system which may has Windows 9 x/ME/2000/NT or Macintosh computer systems. These files on the file server are backed up from time to time. If a file is deleted inadvertently, the file can be recovered from the backup tape.

What is the difference between home directory and working directory?

Home directory is the default working directory when a user logs in. On the other hand, working directory is the user's current directory. Working directory can be changed. It can be changed using cd command. Home directory in Linux contains user's personal data, configuration files, settings of a software etc. The content of home directory is private and the user has a complete control of it. What is the difference between home directory and working directory? Home Directory: Every user will have one home directory and will have complete control over it. On login, home is the default working directory for the user. It contains the configuration files and responsible for login and logout of the user. Working directory: The directory in which the user is working currently is known as working directory. The home may also be the working directory, if the user is working in it.

What is LILO?

ILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, which means that if the default configuration is not correct, it can be changed. Config file for LILO is lilo.conf. What is LILO? LILO stands for Linux Loader which is a bootstrap program. LILO is a code snippet which loads PC BIOS into the main memory at the time of starting the computer system. LILO handles the following tasks: -Locating Linux kernel -Identifying other supporting programs and loading them in the memory -Staring Kernel The selection of various kernel images and boot routines is supported by LILO. For this reason, LILO is known as boot manager.

What are the fields in the/etc/passwd file?

It contains all the information of the users who log into the system. It contains a list of the system's accounts, giving for each account some useful information like user ID, group ID, home directory, shell, etc. It should have general read permission as many utilities, like ls use it to map user IDs to user names, but write access only for the superuser (root). The main fields of /etc/passwd file are: 1. Username: It is used when user logs in. It should be between 1 and 32 characters in length. 2. Password: An x character indicates that encrypted password is stored in /etc/shadow file. 3. User ID (UID): Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are reserved for other predefined accounts. Further UID 100-999 are reserved by system for administrative and system accounts/groups. 4. Group ID (GID): The primary group ID (stored in /etc/group file) 5. User ID Info: The comment field. It allow you to add extra information about the users such as user's full name, phone number etc. This field use by finger command. 6. Home directory: The absolute path to the directory the user will be in when they log in. If this directory does not exists then users directory becomes / 7. Command/shell: The absolute path of a command or shell (/bin/bash). Typically, this is a shell.

What is Kernel? Explain the task it performs.

Kernel is used in UNIX like systems and is considered to be the heart of the operating system. It is responsible for communication between hardware and software components. It is primarily used for managing the systems resources as well. Kernel Activities: - The Kernel task manager allows tasks to run concurrently. - Managing the computer resources: Kernel allows the other programs to run and use the resources. Resources include i/o devices, CPU, memory. - Kernel is responsible for Process management. It allows multiple processes to run simultaneously allowing user to multitask. - Kernel has an access to the systems memory and allows the processes to access the memory when required. - Processes may also need to access the devices attached to the system. Kernel assists the processes in doing so. - For the processes to access and make use of these services, system calls are used. What is Kernel? Explain the task it performs. Kernel is the component that is responsible for managing the resources of a computer system. The tasks are: - Provides the abstraction level for resources such as memory, processors, and I/O devices. -Performs inter process communication -Responds to system calls -Provides methods for synchronization and communication between processes.

What is Linux and why is it so popular?

Linux is a multiuser, multitask GUI based open source operating system developed by Linus Torvalds Torvalds has invited the community to enhance the Linux kernel and thousands of system programmers worked on to enhance. Prior to Linux, there is UNIX. The desktop work stations from various companies were based on UNIX. Later a numerous companies entered and each one of them had their own UNIX version. As the proprietary authority is owned by each company and the lack of central authority weaken UNIX. As Linux is free and runs on any PC platform it gained the popularity very quickly. The following are few more reasons for its popularity: - People who are familiar with UNIX can work on Linux with ease and comfort. - People who want great control over network security and on operating system

What is Linux Shell? What is Shell Script?

Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell. Shell categories in Linux are: - Bourne shell compatible, - C shell compatible, - Nontraditional, and - Historical. A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd. What is Linux Shell? What is Shell Script? Linux shell is the user interface to communicate with Linux operating system. Shell interprets the user requests, executes them. Shell may use kernel to execute certain programs. Shell Script: A shell script is a program file in which certain Linux commands are placed to execute one after another. A shell script is a flat text file. Shell scripts are useful to accept inputs and provide output to the user. Everyday automation process can be simplified by a shell script.

What is NFS? What is its purpose?

NFS is Network File system. It is a file system used for sharing of files over a network. Other resources like printers and storage devices can also be shared. This means that using NFS files can be accessed remotely. Nfs command in linux can be used to achieve this. Purpose of NFS: - NFS can be used for sharing of files remotely. - Data can be stored on a single machine and still remain accessible to others over the network. - Reduction of the number of removable media drives throughout the network since they can be shared. What is NFS? What is its purpose? NFS stands for Network File System. NFS is used to partition a disk on a remote machine disk. NFS allows a quick way of file sharing. The unwanted people access potential is provided by NFS to access hard drive in a network. So that an unauthorized user can not access one's email, delete the files. File services from windows can be accessed. In other words files from one operating system can be shared by another using NFS.

Explain some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop

Network monitoring tools are used to monitor the network, systems present on the network, traffic etc. Ping: Ping command is used to check if the system is in the network or not. To check if the host is operating. e.g. ping ip_address When the command is executed, it returns a detailed summary of the host. Packets sent, received, lost by estimating the round trip time. Traceroute: the command is used to trace the path taken by the packet across a network. Tracing the path here means finding out the hosts visited by the packet to reach its destination. This information is useful in debugging. Roundtrip time in ms is shown for every visit to a host. Tcpdump: commonly used to monitor network traffic. Tcdump captures and displays packet headers and matching them against criteria or all. It interprets Boolean operators and accepts host names, ip address, network names as arguments. Ntop: Network top shows the network usage. It displays summary of network usage by machines on the network in a format as of UNIX top utility. It can also be run in web mode, which allows the display to be browsed with a web browser. It can display network traffic statistics, identify host etc. Interfaces are available to view such information. Explain some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop ping: Used to check whether the system is in the network or not and sends Internet Control Message Protocol ECHO_REQUEST packets to the hosts of network. traceroute: Prints the route packets which were taken by the network host. traceroute utilizes the internet protocol's 'time to live' field and elicits an ICMP TIME_EXCEEDED response. This response is elicited from every gateway including the path to one of the hosts. tcpdump: To dump traffic over a network tcpdump command is used. The headers of the packets over a network interface are printed if the given Boolean expression is true. ntop: Network top program. It displays the summary of network usage of systems over network in a format which is reminiscent of unix top utility. If used in web mode, it displays the result on the web browser.

Which shell do you assign to a POP3 mail-only account?

POP3 mail only account is assigned to the /bin/false shell. However, assigning bash shell to a POP3 mail only gives user login access, which is avoided. /bin/nologin can also be used. This shell is provided to the user when we don't want to give shell access to the user. The user cannot access the shell and it reject shell login on the server like on telnet. It is mainly for the security of the shells. POP3 is basically used for downloading mail to mail program. So for illegal downloading of emails on the shell this account is assigned to the /bin/false shell or /bin/nologin. These both shells are same they both do the same work of rejecting the user login to the shell. The main difference between these two shells is that false shell shows the incorrect code and any unusual coding when user login with it. But the nologin shell simply tells that no such account is available. So nologin shell is used mostly in Linux.

Explain RPM (Red Hat Package Manager) features.

RPM is a package managing system (collection of tools to manage software packages). Features: - RPM can verify software packages. - RPM can be served as a powerful search engine to search for software's. - Components, software's etc can be upgraded using RPM without having to reinstall them - Installing, reinstalling can be done with ease using RPM - During updates RPM handles configuration files carefully, so that the customization is not lost. Explain RPM (Red Hat Package Manager) features. RPM is a powerful software management tool for installing, uninstalling, verifying, querying and updating software packages. RPM is a straight forward program to perform the above software management tasks. It is available with Fedora, Suse, CentOS, Mandriva Linux and other version of Linux.

How secured is Linux? Explain.

Security is the most important aspect of an operating system. Due to its unique authentication module, Linux is considered as more secured than other operating systems. Linux consists of PAM. PAM is Pluggable Authentication Modules. It provides a layer between applications and actual authentication mechanism. It is a library of loadable modules which are called by the application for authentication. It also allows the administrator to control when a user can log in. All PAM applications are configured in the directory "/etc/pam.d" or in a file "/etc/pam.conf". PAM is controlled using the configuration file or the configuration directory.

Which password package is installed for the security of central password?

Shadow password packages are used for security of central passwords. Security is the most important aspect of every operating system. When this package is not installed the user information including passwords is stored in the /etc/passwd file. The password is stored in an encoded format. These encoded forms can be easily identified by the System crackers by randomly encoding the passwords from dictionaries. The Shadow Package solves the problem by relocating the passwords to another file (usually /etc/shadow). The /etc/shadow file is set so that it cannot be read by just anyone. Only root will be able to read and write to the /etc/shadow file.

Explain the difference between a static library and a dynamic library?

Static libraries are loaded when the program is compiled and dynamically-linked libraries are loaded in while the program is running. Dynamic libraries save the RAM space as against the static library because linking to static libraries includes the actual code for the library function(s)/procedure(s) with the executable. DLL code is kept at one location and is usually shared among all the processes that use the DLL. Explain the difference between a static library and a dynamic library. - Static library has functionality that bound to a static program at compile time. Every static program has its own copy of library. - Dynamic libraries are loaded into the memory and binds at run time. The external functionality is accessed at runtime. This process reduces the overall footprint of memory.

You wish to print a file 'draft' with 60 lines to a page. What command would you use?

The command that I would use is: pr -l60 draft - The default page length when using pr is 66 lines. - The -l option specifies a different length.

What are the process states in Linux?

The following are the process states: 1. Running: This is a state where a process is either in running or ready to run. 2. Interruptible: This state is a blocked state of a process which awaits for an event or a signal from another process 3. Uninterruptible: It is also a blocked state. The process is forced to halt for certain condition that a hardware status is waited and a signal could not be handled. 4. Stopped: Once the process is completed, this state occurs. This process can be restarted 5. Zombie: In this state, the process will be terminated and the information will still be available in the process table.

What are the partitions created on the mail server hard drive?

The main partitions are done firstly which are root, swap and boot partition. But for the mail server three different partitions are also done which are as follows: 1. /var/spool - This is done so that if something goes wrong with the mail server or spool than the output cannot overrun the file system. 2. /tmp - Putting this on its own partition prevents any user item or software from overrunning the system files. 3. /home - Putting this on its own is useful for system upgrades or reinstalls. It allow not to wipe off the /home hierarchy along with other areas.

Which command is used to check the number of files and disk space used and the each user's defined quota?

This command gives a summary of the user's quota that how much space and files are left for the user. Every user has a defined quota in Linux. This is done mainly for the security, as some users have only limited access to files. This provides a security to the files from unwanted access. The quota can be given to a single user or to a group of users.

Explain trap command, shift Command, getopts command of linux

Trap command: controls the action to be taken by the shell when a signal is received. Trap [OPTIONS] [ [arg] signspec..] Arg is the action to be taken or executed on receiving a signal specified in signspec. e.g. trap "rm $FILE; exit" // exit (signal) and remove file (action) Shift Command: Using shift command, command line arguments can be accessed. The command causes the positional parameters shift to the left. Shift [n] where n defaults to 1. It is useful when several parameters need to be tested. Getopts command: this command is used to parse arguments passed. It examines the next command line argument and determines whether it is a valid option Getopts {optstring} {variable1}. Here, optsring contains letters to be recognized if a letter is followed by a colon, an argument should be specified. E.g (whether the argument begins with a minus sign and is followed by any single letter contained inside options ) If not, diagnostic messages are shown. It is usually executed inside a loop. Explain trap command; shift Command, getopts command of linux. Trap command is used to catch a signal that is sent to a process. An action is taken based on the signal by using the action which is defined in the trap command instead of taking the default effect on the process. Example: $ trap "echo 'interrupt signal received' " INT. shift command is used to replace the parameters that were sent from command line. For example $ shift will replace $1 by $2 getopts command is used for the purpose of parsing positional parameters.

How documentation of an application is stored?

When a new application is installed its documentation is also installed. This documentation is stored under the directory named for application. For example if my application name is App1 then the path of the documentation will be /user/doc/App1. It contains all the information about the application. It contains date of creating application, name of application and other important module of the application. We can get the basic information of application from the documentation.

Can Linux computer be made a router so that several machines may share a single Internet connection? How?

Yes a Linux machine can be made a router. This is called "IP Masquerade." IP Masquerade is a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers. The IP Masquerade feature allows other "internal" computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses. The IP masquerading can be done by the following steps: 1. The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP connection to the Internet (through an ISP). 2. All other systems on your LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems. 3. Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file. 4. Run /sbin/iptables-the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for your LAN.

Differentiate between Cron and Anacron.

a.) Minimum granularity with Cron is minute while it is in days with Anacron. b.) Cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user. c.) Cron expects the system to be up and running while the Anacron doesn't expect the system to be up and running all the time. In case of Anacron, if a job is scheduled and the system is down that time, it will execute the job as soon as the system is up and running. d.) Cron is ideal for servers while Anacron is ideal for desktops and laptops. e.) Cron should be used when you want a job to be executed at a particular hour and minute while Anacron should be used in when the job can be executed irrespective of the hour and minute.

Which command is used to review boot messages?

dmesg command is used to review boot messages. This command will display system messages contained in the kernel ring buffer. We can use this command immediately after booting to see boot messages. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it. Its basic syntax is: dmesg [options] Invoking dmesg without any of its options causes it to write all the kernel messages to standard output. This usually produces far too many lines to fit into the display screen all at once and thus only the final messages are visible. However, the output can be redirected to the less command through the use of a pipe, thereby allowing the startup messages to be viewed on one screen at a time dmesg | less

Which utility is used to make automate rotation of a log?

logrotate command is used to make automate rotation of log. Syntax of the command is: logrotate [-dv] [-f|] [-s|] config_file+ It allows automatic rotation, compression, removal, and mailing of log files. This command is mainly used for rotating and compressing log files. This job is done every day when a log file becomes too large. This command can also be run by giving on command line. We can done force rotation by giving -f option with this command in command line. This command is also used for mailing. We can give -m option for mailing with this command. This option takes two arguments one is subject and other is recipient name.

How shadow passwords are given?

pwconv command is used for giving shadow passwords. Shadow passwords are given for better system security. The pwconv command creates the file /etc/shadow and changes all passwords to 'x' in the /etc/passwd file. First, entries in the shadowed file which don't exist in the main file are removed. Then, shadowed entries which don't have `x' as the password in the main file are updated. Any missing shadowed entries are added. Finally, passwords in the main file are replaced with `x'. These programs can be used for initial conversion as well to update the shadowed file if the main file is edited by hand. How do you create a new user account?

Which daemon is responsible for tracking events on Linux system?

syslogd is responsible for tracking system information and save it to the desired log files. It provides two system utilities which provide system logging and kernel message trapping. Internet and UNIX domain sockets support enable this utility package to support both local and remote logging. Every logged message contains at least a time and a hostname field, normally a program name field, too. So to track these information this daemon is used. syslogd mainly reacts to the set of signals given by the user. These are the signals given to syslogd: - SIGHUP: This lets syslogd perform a re-initialization. All open files are closed, the configuration file (default is /etc/syslog.conf) will be reread and the syslog facility is started again. - SIGTERM: The syslogd will die. - SIGINT, SIGQUIT: If debugging is enabled these are ignored, otherwise syslogd will die. - SIGUSR1: Switch debugging on/off. This option can only be used if syslogd is started with the - d debug option. - SIGCHLD: Wait for Childs if some were born, because of waiting messages. Which daemon is used for scheduling of the commands? The crontab command is used for scheduling of the commands to run at a later time. SYNTAX crontab [ -u user ] file crontab [ -u user ] { -l | -r | -e } Options -l List - display the current crontab entries. -r Remove the current crontab. -e Edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. When user exits from the editor, the modified crontab will be installed automatically. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly. If the -u option is given than the crontab gives the name of the user whose crontab is to be tweaked. If it is given without this then it will display the crontab of the user who is executing the command.

How environment variable is set so that the file permission can be automatically set to the newly created files?

umask command is used to set file permission on newly created files automatically. Syntax umask [-p] [-S] [mode] It is represented in octal numbers. We can simply use this command without arguments to see the current file permissions. To change the permissions, mode is given in the arguments. The default umask used for normal user is 0002. The default umask for the root user is 0022. For calculating the original values, the values shown by the umask must be subtracted by the default values. It is mainly used for masking of the file and directory permission. The /etc/profile script is where the umask command is usually set for all users. The -S option can be used to see the current default permissions displayed in the alpha symbolic format. For example, umask 022 ensures that new files will have at most 755 permissions (777 NAND 022). The permissions can be calculated by taking the NAND of original value with the default values of files and directories.


Related study sets

Macroeconomics Reading Quizzes (UWL Michels)

View Set

Матем грамотность 3 вариант

View Set

Chapter 7- Assisting With the Nursing Process

View Set