linux services & configuration chapter 7. learning outcomes define function of root user web –...

Click here to load reader

Upload: bryce-mckenzie

Post on 03-Jan-2016

230 views

Category:

Documents


2 download

TRANSCRIPT

Chapter 7

Linux Services & Configuration Chapter 7 Learning Outcomes Define function of root userWeb Based Administration tools in Linux System Linux configuration file and Log filesRemovable Media on a GNOME DesktopRemovable Media on a KDE DesktopCommands to view the partitions that are currently set up on the hard disk:

Root UserRoot user is called super user because it has power far beyond those of mortal user.As root, you can access files and change the system in way other user cannot.If you want to install new software or tweak your system, you should log on as user.

Root UserYou have to become root if you want to do anything that requires a high privilege level (e.g. administering your system).Normally we log in as a regular user. But if you want a privilege of a super user, use the following command to become root:The shell then prompts you for the root password. Type the password and press enter

$su -Root UserBut in some distribution like Knoppix, password is not required. After you type su and press enter, you will become root. Why?In Ubuntu, you do not get to setup a root user when you install Ubuntu.Instead of becoming root by using su command, you can also type sudo followed by the command that you want to run as a root.

Root UserExample:$ su -Password: ******#As you can see, when you become a root, the $ sign eventually become #.This is one of the way you can distinguish between regular user and root

Root UserYou can also use the su command to become a user other than root. This is useful for troubleshooting a problem that is being experienced by a particular user, but not by others on the computer (such as an inability to print or send e-mail). For example, to have the permissions of a user named idzwan, youd type the following: $ su - idzwan

Root UserEven if you were root user before you typed this command, afterward you would have only the permissions to open files and run programs that are available to idzwan.As root user, however, after you type the su command to become another user, you dont need a password to continue. If you type that command as a regular user, you must type the new users password.

Web-Based Administration ToolsWeb-based administration tools are available with many open source projects to make those projects more accessible to casual users.Projects such as Samba and CUPS come with their own Web administration tools. Webmin is a general-purpose tool for administering a variety of Linux system services from your Web browser.The advantages of Web-based administration tools are that you can operate them from a familiar interface (your Web browser) and you can access them remotely.Some Linux distributions come with their own set of graphical administration tools (such as SUSEs YaST or Red Hats system-config tools). You should generally use those instead of any Web-based interface that comes with a project because a distributions own tools are usually better integrated with its tools for starting and stopping services.

Web-Based Administration Tools cont..Open Source Projects Offering Web AdministrationSeveral major open source projects come with Web-based interfaces for configuring those projects.Regardless of which Linux you are using, you can use your Web browser to configure the following projects:1.Samba2.CUPS3.Squirrelmail4. mailman

Web-Based Administration Tools cont..1. SambaFree software, developed by Australian Andrew Tridgell.Run on most unix and Unix-like system.Released under GNU General Public Licence.The name Samba comes from SMB(Server Message Block).Web-Based Administration Tools cont..Features of SambaAllow file and print sharing between computers running Windows and computers running Unix.Set up network shares for chosen Unix directories.Unix users can either mount the shares directly as part of their files structure using the smbmount command.Each directory can have different access privileges overlaid on top of the normal Unix file protections.

Web-Based Administration Tools cont..Advantages of SambaPortable across multiple platforms.Allow for easier networking of Windows workstations to computers running other platforms.

Web-Based Administration Tools cont..Disadvantages of SambaMaintaining compatibility with Microsofts implementationThreat of legal action against commercial users of Samba.

Web-Based Administration Tools cont..2. CUPSA short of the Common Unix Printing System that allows a computer to add as print server.The computer running CUPS is a host that can accept print jobs from clients computer, process them and send them to the appropriate printer.CUPS administration tool to manage printers and classes and do a variety of administration tasks.Consists of a print spooler and scheduler.Use the Internet Printing Protocol (IPP) as the basis for managing print jobs and queuesLicense under GNU General Public License and GNU Lesser General Public License version 2.

Web-Based Administration Tools cont..Features of CUPSFilter SystemCan process a variety of data format on the print serverConverts the print job data into the final language of format of the printer via a series of filtersUses MIME types for identifying file formats.Scheduler The CUPS scheduler implement IPP over HTTP/1.1Provides a web-based interface for managing print jobs, the configuration of the server, and for documentation about CUPS itself

Web-Based Administration Tools cont..Advantages of CUPSAlready has commands for submitting, viewing and manipulating the job queueYou can easily set up a pool which will allocate jobs to slots as they become availableCan be used on/by remote machines easilyAdding extra job slots just means adding a new printerJobs can easily be paused or delayedCan submit from Windows using Samba

Web-Based Administration Tools cont..Disadvantages of CUPSHas no way of adding job interdependence.Probably doesnt scale to several thousand processors wellYou could end up with a lot of scrap paper if you use the wrong queue.

Web-Based Administration Tools cont..3. SquirrelMailSquirrelMail is a web-based email application started by Nathan and Luke Ehresman and written in the PHP scripting language. It can be installed on almost all web servers as long as PHP is present and the web server has access to an IMAP and SMTP server.SquirrelMail outputs valid HTML 4.0 for its presentation, making it compatible with a majority of current web browsers. SquirrelMail uses a plugin architecture to accommodate additional features around the core application, and over 200 plugins are available on the SquirrelMail website.Licensed under the GNU General Public License.It is currently available in over 50 languages.SquirrelMail is included in the repositories of many major GNU/Linux distributions It is independently downloaded.Web-Based Administration Tools cont..Features of SquirrelMailA templating systemA RPC interface for use by other applications as well as AJAX-enabled SquirrelMail template sets (skins) SquirrelMail has all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation. Faster login times due to improved message header caching Security enhancements, such as HTTP Only cookiesImproved usability/accessibility.

Web-Based Administration Tools cont..Advantages of SquirrelMailSupport for text web browsers.No JavaScript support required.Easy integration into an already existing site.Advanced skinning support.

Web-Based Administration Tools cont..Disadvantages of SquirrelMailA separate web server must be set up.Moderate configuration required.Low error control and tracing possibilities.IMAP (Internet Message Access Protocol) must be enabled.

Web-Based Administration Tools cont..4. MailmanGNU Mailman is a computer software application from the GNU project for managing electronic mailing lists. Mailman is coded primarily in Python and currently maintained by Barry Warsaw. Mailman is free software, distributed under the GNU General Public License.

Web-Based Administration Tools cont..Features of MailmanA Web browser interface for list administration, archiving of messages, spam filtering. A customizable home page for each mailing list. Integrated bounce detection and automatic handling of bouncing addresses. Integrated spam filters Multiple list owners and moderators. Support for virtual domains.

Web-Based Administration Tools cont..Mailman also integrates most things people want to do with mailing lists, including archiving, mail-to-news gateways, integrated bounce handling, spam prevention, email-based admin commands, direct SMTP delivery (with fast bulk mailing), support for virtual domains, and more. Mailman runs on most Unix-like systems, is compatible with most web servers and browsers, and most SMTP servers. Mailman requires Python version 1.5 or newer. Python is a free object-oriented scripting language. A few files are written in C for security purposes.

Web-Based Administration Tools cont..Advantages of MailmanUsers email addresses, even the entire list, can be set as private. Granular(rough) control over who can post. Ability to easily suspend posts to the entire list on a temporary basis. Users are free to subscribe and unsubscribe to a list at will. Automatic removal of stale email addresses.

Web-Based Administration Tools cont..Disadvantages of MailmanRequires technical personnel establish and maintain list. Can reveal everyone's email address included in the list. No facility for message moderation.

Web-Based Administration Tools cont..

Linux Configuration File Describe the contents of the following configuration files:

1) $HOME.2) /etc3) /etc/cron*4) /etc/cups5) /etc/default6) /etc/init.d7) /etc/mail8) /etc/pcmcia9) /etc/ppp10) /etc/skel11) /etc/sysconfig

Linux Configuration File 1) $HOMEAll users store information in their home directories that directs how their login accounts behave. Most configuration files in $HOME begin with a dot (.), so they dont appear in a users directory when you use a standard ls command (you need to type ls -a to see them). There are dot files that define how each users shell behaves, the desktop look-and-feel, and options used with your text editor. There are even files such as .ssh/* and .rhosts that configure network permissions for each user. (To see the name of your home directory, type echo $HOME from a shell.)

2) /etc This directory contains most of the basic Linux system-configuration files

3) /etc/cron*Contain time schedule for the execution of recurring tasks according to a combination of the time, day of the month, month, day of the week, and week.What is cron? Cron is the name of program that enables Linux/UNIX users to execute commands or scripts (groups of commands) automatically at a specified time/date.

Linux Configuration File 4) /etc/cupsContains files used to configure the CUPS printing service

5) /etc/defaultContains files that set default values for various utilities. For example, the file for the useradd command defines the default group number, home directory, password expiration date, shell, and skeleton directory (/etc/skel) that are used when creating a new user account.

Linux Configuration File 6) /etc/init.dContains the initialization and termination scripts for changing init states.7) /etc/mailContains files used to configure your sendmail mail service.

8) /etc/pcmciaContains configuration files that allow you to have a variety of PCMCIA (Personal Computer Memory Card International Association ) cards configured for your computer. (PCMCIA slots are those openings on your laptop that enable you to have credit cardsized cards attached to your computer. You can attach devices such as modems and external CD-ROMs.)

Linux Configuration File 9) /etc/pppContains several configuration files used to set up Point-to-Point Protocol (PPP) so that you can have your computer dial out to the Internet.

10) /etc/skelAny files contained in this directory are automatically copied to a users home directory when that user is added to the system. By default, most of these files are dot (.) files, such as .kde (a directory for setting KDE desktop defaults) and .bashrc (for setting default values used with the bash shell).

Linux Configuration File 11) /etc/sysconfigContains important system configuration files that are created and maintained by various services (including iptables, samba, and most networking services). These files are critical for Linux distributions that use GUI administration tools but are not used on other Linux systems at all.

Linux Configuration File Utilities for logging error and debugging messages

The main utilities for logging error and debugging messages for Linux are the syslogd and klogd daemons.

General system logging is done by syslogd. Logging that is specific to kernel activity is done by klogd.

Logging is done according to information in the /etc/syslog.conf file. Messages are typically directed to log files that are usually in the /var/log directory. What is daemons? A process that runs in the background and performs a specified operation at predefined times or in response to certain events. The term daemon is a UNIX term, though many other operating systems provide support for daemons, though they're sometimes called other names. Windows, for example, refers to daemons as System Agents and services. For example, lpd is a daemon that controls the flow of print jobs to a printer.

Linux Configuration File Removable Media on a GNOME DesktopThe GNOME desktop offers the Removable Drives and Media Preferences window to define what happens when you attach removable devices or insert removable media into the computer. The descriptions in this section are based on GNOME 2.16.From a GNOME desktop, select SystemPreferencesRemovable Drives and Media to see how your system is configured to handle removable hardware and media.

Removable Media on a GNOME Desktop

Removable Media on a GNOME DesktopThe following settings are available from the Removable Drives and Media Preferences window on the Storage tab. These settings relate to how removable media are handled when they are inserted or plugged in:1) Mount removable drives when hot-plugged When a removable drive (such as a USB hard drive) is plugged into a running system, that drive is automatically mounted in a subdirectory of /media.2) Mount removable media when insertedWhen a removable medium (such as a CD or DVD) is inserted into a drive, the medium is automatically mounted to a subdirectory of /media that is based on the mediums volume ID.Removable Media on a GNOME Desktop3) Browse removable media when insertedAfter a removable medium is inserted and mounted, a Nautilus window opens to display the contents of that medium.4) Auto-run programs on new drives and mediaAfter a removable medium is inserted and mounted, auto-run any program in the top-level directory of the medium that is named .autorun, autorun, or autorun.sh.5) Auto-open files on new drives and mediaAfter a removable medium is inserted and mounted, open any file in the top-level directory of the medium that is named .autoopen or autoopen.6) Burn a CD or DVD when a blank disc is insertedWhen a blank CD or DVD is inserted, you are asked if you want to make an audio CD or data CD. Either selection opens a CD/DVD Creator Nautilus window for you to drag-and-drop files on. Click Write to Disc when you are done, and the files are burned to that medium.

When you insert a removable medium (CD or DVD) or plug in a removable device (digital camera or USB flash drive) from a KDE desktop in SUSE, a window opens to let you choose the type of action to take on it. If you want to add a different action, or change an existing action, click the Configure button.

Removable Media on a KDE Desktop

Removable Media on a KDE DesktopFrom the KDE Control Module, select the media type you want to change (in this case, Mounted Removable Medium). Click Add, and then select the type of action you would like to add as an option when that type of media is detected.If you have installed the Linux kernel source code, source code files for available drivers are stored in subdirectories of the /usr/src/linux*/drivers directory. You can find information about these drivers in a couple of ways:

Removable Media on a KDE Desktop1) make xconfigWith /usr/src/linux* as your current directory, type make xconfig from a Terminal window on the desktop. Select the category of module you want and then click Help next to the driver that interests you. The help information that appears includes a description of the driver. (If your system is missing graphical libraries needed to run make xconfig, try make menuconfig instead.)2) DocumentationThe /usr/src/linux*/Documentation directory contains lots of plain-text files describing different aspects of the kernel and related drivers.

Removable Media on a KDE Desktop3) After modules have been built, they are installed in the /lib/modules/ subdirectories. 4) The name of the directory is based on the release number of the kernel that the modules were compiled for.5) Modules that are in that directory can then be loaded and unloaded as they are needed.

Removable Media on a KDE Desktop6) Listing Loaded ModulesTo see which modules are currently loaded into the running kernel on your computer, use the lsmod command. Heres an example:

Removable Media on a KDE Desktop7) This output shows a variety of modules that have been loaded on a Linux system, including several to support the ALSA sound system, some of which provide OSS compatibility (snd_seq_oss). 8) To find information about any of the loaded modules, use the modinfo command. For example, you could type the following:

Removable Media on a KDE Desktop1) fdiskThere are many usage of the fdisk command. Here are some examples.fdisk /dev/hda (for the first IDE disk) fdisk /dev/sdc (for the third SCSI disk) fdisk /dev/eda (for the first PS/2 ESDI drive) fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)

Commands to view the partitions that are currently set up on the hard disk:

2) To see what partitions are currently set up on partitions that the Linux kernel has detected, use the fdisk l command

Commands to view the partitions that are currently set up on the hard disk:

This output shows the disk partitioning for a computer capable of running both Linux and Microsoft Windows. You can see that the Linux partition on /dev/sda3 has most of the space available for data. There is a Windows partition (/dev/sda1) and a Linux swap partition (/dev/sda5).There is also a small /boot partition (46MB) on /dev/sda2. In this case, the root partition for Linux has 3.3GB of disk space and resides on /dev/sda3. Fdisk -l uses partition information found in /proc/partitions unless explicitly given on the command line.

Commands to view the partitions that are currently set up on the hard disk:

3) Mount to see what partitions are actually being used for your Linux system (which available disk partitions are actually mounted and where they are mounted):

Commands to view the partitions that are currently set up on the hard disk:

Although some of the file systems shown as mounted are for special purposes (/sys, /proc, and others), our concern here is with disk partition (/dev/hd*, /dev/sd*, and so on). The mounted Linux partitions in this case are /dev/sda2, which provides space for the /boot directory (contains data for booting Linux), and /dev/sda3, which provides space for the rest of the Linux file system beginning from the root directory (/).This particular system also contains a Windows partition that was mounted in the /mnt/win directory and a CD that was mounted in /media/cdrecorder. (With most GUI interfaces, the CD is typically mounted automatically when you insert it.

Commands to view the partitions that are currently set up on the hard disk: