520 likes | 652 Views
Chapter 7. Linux Services & Configuration. Learning Outcomes. Define function of root user Web – Based Administration tools in Linux System Linux configuration file and Log files Removable Media on a GNOME Desktop Removable Media on a KDE Desktop
E N D
Chapter 7 Linux Services & Configuration
Learning Outcomes • Define function of root user • Web – Based Administration tools in Linux System • Linux configuration file and Log files • Removable Media on a GNOME Desktop • Removable Media on a KDE Desktop • Commands to view the partitions that are currently set up on the hard disk:
Root User • Root 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 User • You 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 User • But 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 User • Example: $ 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 User • You 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, you’d type the following: $ su - idzwan
Root User • Even 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 don’t need a password to continue. • If you type that command as a regular user, you must type the new user’s password.
Web-Based Administration Tools • Web-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. • Webminis 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 SUSE’s YaST or Red Hat’s system-config tools). • You should generally use those instead of any Web-based interface that comes with a project because a distribution’s own tools are usually better integrated with its tools for starting and stopping services.
Web-Based Administration Tools cont.. Open Source Projects Offering Web Administration • Several 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.Samba 2.CUPS 3.Squirrelmail 4. mailman
Web-Based Administration Tools cont.. 1. Samba • Free software, developed by Australian Andrew Tridgell. • Run on most unix and Unix-like system. • Released under GNUGeneral Public Licence. • The name Samba comes from SMB(Server Message Block).
Web-Based Administration Tools cont.. Features of Samba • Allow 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 smbmountcommand. • Each directory can have different access privileges overlaid on top of the normal Unix file protections.
Web-Based Administration Tools cont.. Advantages of Samba • Portable across multiple platforms. • Allow for easier networking of Windows workstations to computers running other platforms.
Web-Based Administration Tools cont.. Disadvantages of Samba • Maintaining compatibility with Microsoft’s implementation • Threat of legal action against commercial users of Samba.
Web-Based Administration Tools cont.. 2. CUPS • A 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 queues • License under GNU General Public License and GNU Lesser General Public License version 2.
Web-Based Administration Tools cont.. Features of CUPS • Filter System • Can process a variety of data format on the print server • Converts the print job data into the final language of format of the printer via a series of filters • Uses MIME types for identifying file formats. • Scheduler • The CUPS scheduler implement IPP over HTTP/1.1 • Provides 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 CUPS • Already has commands for submitting, viewing and manipulating the job queue • You can easily set up a pool which will allocate jobs to slots as they become available • Can be used on/by remote machines easily • Adding extra job slots just means adding a new printer • Jobs can easily be paused or delayed • Can submit from Windows using Samba
Web-Based Administration Tools cont.. Disadvantages of CUPS • Has no way of adding job interdependence. • Probably doesn’t scale to several thousand processors well • You could end up with a lot of scrap paper if you use the wrong queue.
Web-Based Administration Tools cont.. 3. SquirrelMail • SquirrelMail 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 SquirrelMail • A templating system • A 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 cookies • Improved usability/accessibility.
Web-Based Administration Tools cont.. Advantages of SquirrelMail • Support 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 SquirrelMail • A 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. Mailman • GNU 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 Mailman • A 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 Mailman • Users email addresses, even the entire list, can be set as private. • Granular(rough) controlover 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 Mailman • Requires technical personnel establish and maintain list. • Can reveal everyone's email address included in the list. • No facility for message moderation.
Linux Configuration File Describe the contents of the following configuration files: 1) $HOME. 2) /etc 3) /etc/cron* 4) /etc/cups 5) /etc/default 6) /etc/init.d • 7) /etc/mail • 8) /etc/pcmcia • 9) /etc/ppp • 10) /etc/skel • 11) /etc/sysconfig
Linux Configuration File 1) $HOME • All 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 don’t appear in a user’s 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 user’s 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.)
Linux Configuration File 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/cups • Contains files used to configure the CUPS printing service 5) /etc/default • Contains 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.d • Contains the initialization and termination scripts for changing init states. 7) /etc/mail • Contains files used to configure your sendmail mail service. 8) /etc/pcmcia • Contains 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 card–sized cards attached to your computer. You can attach devices such as modems and external CD-ROMs.)
Linux Configuration File 9) /etc/ppp • Contains 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/skel • Any files contained in this directory are automatically copied to a user’s 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/sysconfig • Contains 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.
Removable Media on a GNOME Desktop • The 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 System➪Preferences➪Removable Drives and Media to see how your system is configured to handle removable hardware and media.
Removable Media on a GNOME Desktop • The 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 inserted When 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 medium’s volume ID.
Removable Media on a GNOME Desktop 3) Browse removable media when inserted After 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 media After 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 media After 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 inserted When 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.
Removable Media on a KDE Desktop • 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 • From 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 Desktop 1) make xconfig • With /usr/src/linux* as your current directory, type make xconfigfrom 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) Documentation • The /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 Desktop 3) 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 Desktop 6) Listing Loaded Modules • To see which modules are currently loaded into the running kernel on your computer, use the lsmod command. Here’s an example:
Removable Media on a KDE Desktop 7) 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:
Commands to view the partitions that are currently set up on the hard disk: 1) fdisk • There 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 thefdisk –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.