Archive for April, 2007

Web hosting packages - Chapter 4 . Learning Basic Administration 149 Configuring

Monday, April 30th, 2007

Chapter 4 . Learning Basic Administration 149 Configuring Hardware In a perfect world, after installing and booting Linux, all of your hardware is detected and available for access. Although many Linux systems are rapidly moving closer to that world, there are times when you must take special steps to get your computer hardware working. Also, the growing use of removable USB and FireWire devices (CDs, DVDs, flash drives, digital cameras, and removable hard drives) has made it important for Linux to: . Efficiently manage hardware that comes and goes. . Look at the same piece of hardware in different ways (for example, be able to see a printer as a fax machine, scanner, and storage device, as well as a printer). If you are using a Linux system that includes the 2.6 kernel (as the latest versions of most major Linux systems do), new kernel features have made it possible to change drastically the way hardware devices are detected and managed. Features in, or closely related to, the kernel include Udev (to dynamically name and create devices as hardware comes and goes) and hotplug and hal (to pass information about hardware changes to user space). Then features such as fstab-sync and gnome-volumemanager are used to react to hardware changes (for example, to mount a device or launch an application to read the device). If all this sounds a bit confusing, don t worry. It s actually designed to make your life as a Linux user much easier. The end result of features built on the 2.6 kernel is that device handling in Linux has become: . More automatic For most common hardware, when a hardware device is connected or disconnected, it is automatically detected and identified. Interfaces to access the hardware are added, so it is accessible to Linux. Then the fact that the hardware is present (or removed) is passed to the user level, where applications listening for hardware changes are ready to mount the hardware and/or launch an application (such as an image viewer or music player). . More flexible If you don t like what happens automatically when a hardware item is connected or disconnected, you can change it. For example, features built into GNOME and KDE desktops let you choose what happens when a music CD or movie DVD is inserted, or when a digital camera is connected. If you prefer a different program be launched to handle it, you can easily make that change. This section covers several issues relating to getting your hardware working properly in Linux. First, it described how to configure Linux to deal with removable media. Then it tells how to use tools for manually loading and working with drivers for hardware that is not detected and loaded properly.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

148 Part II . Running the Show Table (Web server logs)

Monday, April 30th, 2007

148 Part II . Running the Show Table 4-3 useradd Options for Changing User Defaults Options Description -b default_home Set the default directory in which user home directories are created. Replace default_home with the directory name to use (-b garage). Usually this is /home. -e default_expire_date Set the default expiration date on which the user account is disabled. The default_expire_date value should be replaced with a date in the form MM/DD/YYYY (-e 10/15/2007). -f default_inactive Set the number of days after a password has expired before the account is disabled. Replace default_ inactive with a number representing the number of days (-f 7). -g default_group Set the default group that new users will be placed in. Normally useradd creates a new group with the same name and ID number as the user. Replace default_ group with the group name to use (-g bears). -s default_shell Set the default shell for new users. Normally this is /bin/bash. Replace default_shell with the full path to the shell that you want as the default for new users (-s /bin/ash). To set any of the defaults, give the -D option first, and then add the defaults you want to set. For example, to set the default home directory location to /home/everyone and the default shell to /bin/tcsh, type the following: # useradd -D -b /home/everyone -s /bin/tcsh Besides setting up user defaults, an administrator can create default files that are copied to each user s home directory for use. These files can include login scripts and shell configuration files (such as .bashrc). Other commands exist that are useful for working with user accounts, including usermod (to modify settings for an existing account) and userdel (to delete an existing user account).
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision servlet hosting services

Web hosting script - Chapter 4 . Learning Basic Administration 147 Setting

Sunday, April 29th, 2007

Chapter 4 . Learning Basic Administration 147 Setting User Defaults The useradd command determines the default values for new accounts by reading the /etc/login.defs file. You can modify those defaults by either editing that file manually with a standard text editor or by running the useradd command with the -D option. Although login.defs is different on different Linux systems, here is an example containing many of the settings you might find in a login.defs file: PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_MIN_LEN 5 PASS_WARN_AGE 7 UID_MIN 500 UID_MAX 60000 GID_MIN 500 GID_MAX 60000 CREATE_HOME yes All uncommented lines contain keyword/value pairs. For example, the keyword PASS_MIN_LEN is followed by some white space and the value 5. This tells useradd that the user password must be at least five characters. Other lines let you customize the valid range of automatically assigned user ID numbers or group ID numbers. (Red Hat starts at UID 500; other Linuxes start with UID 100.) A comment section that explains that keyword s purpose precedes each keyword (which I edited out here to save space). Altering a default value is as simple as editing the value associated with a keyword and then saving the file. If you want to view the defaults, type the useradd command with the -D option, as follows: # useradd -D GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel You can also use the -D option to change defaults. When run with this flag, useradd refrains from actually creating a new user account; instead, it saves any additionally supplied options as the new default values in /etc/login.defs. Not all useradd options can be used in conjunction with the -D option. You can use only the five options listed in Table 4-3.
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Sri lanka web server - 146 Part II . Running the Show Each

Sunday, April 29th, 2007

146 Part II . Running the Show Each line in the /etc/passwd file represents a single user account record. Each field is separated from the next by a colon (:) character. The field s position in the sequence determines what it is. As you can see, the login name is first. Again, the password field contains an x because we are using a shadow password file to store encrypted password data. The user ID selected by useradd is 502. The primary group ID is 100, which corresponds to the users group in the /etc/group file. The comment field was correctly set to Mary Smith, the home directory was automatically assigned as /home/mary, and the command shell was assigned as /bin/tcsh, exactly as specified with the useradd options. By leaving out many of the options (as I did in the first useradd example), defaults are assigned in most cases. For example, by not using -g users or -G wheel,sales, in Red Hat Linux a group named mary would have been created and assigned to the new user. Other Linux systems assign users as the group name by default. Likewise, excluding -s /bin/tcsh causes /bin/bash to be assigned as the default shell. The /etc/group file holds information about the different groups on your Linux system and the users who belong to them. Groups are useful for enabling multiple users to share access to the same files while denying access to others. Peek at the /etc/group file, and you find something similar to this: bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin,adm adm:x:4:root,adm,daemon tty:x:5: disk:x:6:root lp:x:7:daemon,lp mem:x:8: kmem:x:9: wheel:x:10:root,joe,mary … nobody:x:99: users:x:100: chris:x:500 sheree:x:501 sales:x:601:bob,jane,joe,mary Each line in the group file contains the name of a group, the group ID number associated with it, and a list of users in that group. By default, each user is added to his or her own group, beginning with GID 500. Note that mary was added to the wheel and sales groups instead of having her own group. It is actually rather significant that mary was added to the wheel group. By doing this, you grant her the capability to use the sudo command to run commands as the root user (provided that sudo is configured as described later in this chapter).
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Simple web server - Chapter 4 . Learning Basic Administration 145 When

Saturday, April 28th, 2007

Chapter 4 . Learning Basic Administration 145 When you choose a username, don t begin with a number (for example, 06jsmith). Also, it s best to use all lowercase letters, no control characters or spaces, and a maximum of 8 characters. The useradd command allows up to 32 characters, but some applications can t deal with usernames that long. Tools such as ps display UIDs instead of names if names are too long. Having users named Jsmith and jsmith can cause confusion with programs (such as sendmail) that don t distinguish case. Next, set Mary s initial password using the passwd command. You re prompted to type the password twice: # passwd mary Changing password for user mary. New password: ******* Retype new password: ******* (Asterisks in this example represent the password you type. Nothing is actually displayed when you type the password.) In creating the account for Mary, the useradd command performs several actions: . Reads the /etc/login.defs file to get default values to use when creating accounts. . Checks command-line parameters to find out which default values to override. . Creates a new user entry in the /etc/passwd and /etc/shadow files based on the default values and command-line parameters. . Creates any new group entries in the /etc/group file. (Red Hat creates a group using the new user s name; Gentoo adds the user to the users group; and SUSE adds it to every group you set for new users, such as dialout, audio, video, and other services.) . Creates a home directory, based on the user s name, in the /home directory. . Copies any files located within the /etc/skel directory to the new home directory. This usually includes login and application startup scripts. The preceding example uses only a few of the available useradd options. Most account settings are assigned using default values. You can set more values explicitly, if you want to; here s an example that uses a few more options to do so: # useradd -g users -G wheel,sales -s /bin/tcsh -c Mary Smith mary In this case, useradd is told to make users the primary group mary belongs to (-g), add her to the wheel and sales groups, and assign tcsh as her primary command shell (-s). A home directory in /home under the user s name (/home/mary) is created by default. This command line results in a line similar to the following being added to the /etc/passwd file: mary:x:502:100:Mary Smith:/home/mary:/bin/tcsh Tip
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services

Web hosting billing - 144 Part II . Running the Show Table

Saturday, April 28th, 2007

144 Part II . Running the Show Table 4-2 (continued) Option Description -f -1 Set the number of days after a password expires until the account is permanently disabled. The default, -1, disables the option. Setting this to 0 disables the account immediately after the password has expired. Replace -1 with the number to use. -g group Set the primary group (as listed in the /etc/group file) the new user will be in. Replace group with the group name (-g wheel). -G grouplist Add the new user to the supplied comma-separated list of groups (-G wheel,sales,tech,lunch). -k skel_dir Set the skeleton directory containing initial configuration files and login scripts that should be copied to a new user s home directory. This parameter can be used only in conjunction with the -m option. Replace skel_dir with the directory name to use. (Without this option, the /etc/skel directory is used.) -m Automatically create the user s home directory and copy the files in the skeleton directory (/etc/skel) to it. -M Do not create the new user s home directory, even if the default behavior is set to create it. -n Turn off the default behavior of creating a new group that matches the name and user ID of the new user. This option is available with Red Hat Linux systems. Other Linux systems often assign a new user to the group named users instead. -o Use with -u uid to create a user account that has the same UID as another username. (This effectively lets you have two different usernames with authority over the same set of files and directories.) -p passwd Enter a password for the account you are adding. This must be an encrypted password. Instead of adding an encrypted password here, you can simply use the passwd user command later to add a password for user. -s shell Specify the command shell to use for this account. Replace shell with the command shell (-s bash). -u user_id Specify the user ID number for the account (-u 474). Without the -u option, the default behavior is to automatically assign the next available number. Replace user_id with the ID number (-u). For example, let s create an account for a new user named Mary Smith with a login name of mary. First, log in as root, and then type the following command: # useradd -c Mary Smith mary
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision j2ee hosting services

Chapter 4 . Learning Basic Administration 143 Creating (Web hosting faq)

Friday, April 27th, 2007

Chapter 4 . Learning Basic Administration 143 Creating User Accounts Every person who uses your Linux system should have a separate user account. Having a user account provides each person with an area in which to securely store files as well as a means of tailoring his or her user interface (GUI, path, environment variables, and so on) to suit the way that he or she uses the computer. You can add user accounts to most Linux systems in several ways Red Hat systems use the redhat-config-users utility, for example, and SUSE offers a user setup module in YaST. This chapter describes how to add user accounts from the command line with useradd because most Linux systems include that command. Adding Users with useradd The most straightforward method for creating a new user from the shell is with the useradd command. After opening a Terminal window with root permission, you simply invoke useradd at the command prompt, with details of the new account as parameters. The only required parameter is the login name of the user, but you probably want to include some additional information ahead of it. Each item of account information is preceded by a single letter option code with a dash in front of it. Table 4-2 lists the options available with useradd. Table 4-2 useradd Command Options Option Description -c comment Provide a description of the new user account. Often the person s -c comment here full name. Replace comment with the name of the user account (-c jake). Use quotes to enter multiple words (-c jake jackson ). -d home_dir Set the home directory to use for the account. The default is to name it the same as the login name and to place it in /home. Replace home_dir with the directory name to use (for example, -d /mnt/homes/jake). -D Rather than create a new account, save the supplied information as the new default settings for any new accounts that are created. -e expire_date Assign the expiration date for the account in MM/DD/YYYY format. Replace expire_date with a date you want to use (-e 05/06/2005). Continued
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision servlet hosting services

Web site layout - 142 Part II . Running the Show In

Friday, April 27th, 2007

142 Part II . Running the Show In this session, the user jake runs the sudo command to unmount the /mnt/win file system (using the umount command). He is given a warning and asked to provide his password (this is jake s password, not the root password). Even after jake has given the password, he must still use the sudo command to run subsequent administrative commands as root (the umount fails, but the sudo umount succeeds). Notice that he is not prompted for a password for the second sudo. That s because after entering his password successfully, he can enter as many sudo commands as he wants for the next 5 minutes without having to enter it again. (You can change the timeout value from 5 minutes to however long you want by setting the passwd_timeout value in the /etc/sudoers file.) The preceding example grants a simple all-or-nothing administrative privilege to everyone you put in the wheel group. However, the /etc/sudoers file gives you an incredible amount of flexibility in permitting individual users and groups to use individual applications or groups of applications. Refer to the sudoers and sudo man pages for information about how to tune your sudo facility. Administering Your Linux System Your system administrator duties don t end after you have installed Linux. If multiple people are using your Linux system, you, as administrator, must give each person his own login account. You ll use useradd and related commands to add, modify, and delete user accounts. Configuring hardware is also on your duty list. When you add hardware to your Linux computer, that hardware is often detected and configured automatically. In some cases, though, the hardware may not have been set up properly, and you will use commands such as lsmod, modprobe, insmod, and rmmod to configure the right modules to get the hardware working. A device driver is the code permanently built into the kernel to allow application programs to talk to a particular piece of hardware. A module is like a driver, but it is loaded on demand. The Configuring Hardware section later in this chapter includes information about using these commands to configure modules. Managing file systems and disk space is your responsibility, too. You must keep track of the disk space being consumed, especially if your Linux system is shared by multiple users. At some point, you may need to add a hard disk or track down what is eating up your disk space (you use commands such as find to do this). Your duties also include monitoring system performance. You may have a runaway process on your system or you may just be experiencing slow performance. Tools that come with Linux can help you determine how much of your CPU and memory are being consumed. These tasks are explored in the rest of this chapter. Note
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services

Chapter 4 . Learning Basic Administration 141 Here s (Database web hosting)

Friday, April 27th, 2007

Chapter 4 . Learning Basic Administration 141 Here s an example of how to use the sudo facility to cause any users that are added to the wheel group to have full root privileges: 1. As the root user, edit the /etc/sudoers file by running the visudo command: # /usr/sbin/visudo By default, the file opens in vi, unless your EDITOR variable happens to be set to some other editor acceptable to visudo (for example, export EDITOR=gedit). The reason for using visudo is that the command locks the /etc/sudoers file and does some basic sanity checking of the file to ensure it has been edited correctly. If you are stuck here, refer to the vi tutorial in Chapter 2 for information on using the vi editor. 2. Uncomment the following line to allow users in the wheel group to have full root privileges on the computer: %wheel ALL=(ALL) ALL This line causes users in the wheel group to provide a password (their own password, not the root password) in order to use administrative commands. To allow users in the wheel group to have that privilege without using a password, uncomment the following line instead: %wheel ALL=(ALL) NOPASSWD: ALL 3. Save the changes to the /etc/sudoers file (in vi, type Esc, and then ZZ). 4. Still as root user, open the /etc/group file in any text editor and add to the wheel line any users you want to have root privilege. For example, if you were to add the users mary and jake to the wheel group, the line would appear as follows: wheel:x:10:root,mary,jake Now users mary and jake can run the sudo command to run commands, or parts of commands, that are normally restricted to the root user. The following is an example of a session by the user jake after he has been assigned sudo privileges: [jake]$ sudo umount /mnt/win We trust you have received the usual lecture from the local System Administrator. It usually boils down to these two things: #1) Respect the privacy of others. #2) Think before you type. Password: ********* [jake]$ umount /mnt/win mount: only root can mount /dev/hda1 on /mnt/win [jake]$ sudo umount /mnt/win [jake]$ Note
Note: If you are looking for high quality webhost to host and run your jsp application check Vision jsp web hosting services

140 Part II . (Yahoo free web hosting) Running the Show If

Thursday, April 26th, 2007

140 Part II . Running the Show If you are using Red Hat Enterprise Linux system, the System Logs utility is a good way to step through your system s log files. From the red hat menu, select Applications. System Tools.System Logs. You not only can view boot, kernel, mail, security, and other system logs, but you can also use the filter box to search for particular terms (such as a model number of a piece of hardware that s not working). On SUSE systems, you can view some log files from YaST. For example, select Miscellaneous and then choose either View System Log or View Start-up Log to view the messages or boot.msg files, respectively. Using sudo and Other Administrative Logins You don t hear much about other administrative logins (besides root) being used with Linux. It was a fairly common practice in UNIX systems to have several different administrative logins that allowed administrative tasks to be split among several users. For example, a person sitting near a printer could have lp permissions to move print jobs to another printer if he knew a printer wasn t working. In any case, administrative logins are available with Linux, so you may want to look into using them. Here are some examples: . lp User can control some printing features. Having a separate lp administrator allows someone other than the superuser to do such things as move or remove lp logs and print spool files. The home directory for lp is /var/spool/lpd. . mail User can work with administrative e-mail features. The mail group, for many Linux systems, has group permissions to use mail files in /var/ spool/mail (which is also often the mail user s home directory). . uucp User owns various uucp commands (once used as the primary method for dial-up serial communications) as well as log files in /var/ log/uucp, spool files in /var/spool, administrative commands (such as uuchk, uucico, uuconv, and uuxqt) in /usr/sbin, and user commands (uucp, cu, uuname, uustat, and uux) in /usr/bin. The home directory for uucp is /var/spool/uucp. . bin User owns many commands in /bin in traditional UNIX systems. This is not the case in some Linux systems (such as Red Hat and Gentoo) because root owns most executable files. The home directory of bin is /bin. . news User could do administration of Internet news services, depending on how you set permission for /var/spool/news and other news-related resources. The home directory for news is /etc/news. One way to give full or limited root privileges to any nonroot user is to set up the sudo facility, which simply entails adding the user to /etc/sudoers and defining what privilege you want that user to have. Then the user can run any command he or she is privileged to use by preceding that command with the sudo command.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision shared web hosting services