Archive for October, 2007

734 Part V . Running Servers (Top web site) Figure 27-2:

Wednesday, October 31st, 2007

734 Part V . Running Servers Figure 27-2: Use SWAT from your browser to manage your Samba configuration. The following sections explain how to use SWAT to create your configuration entries (in /etc/samba/smb.conf) and to work with that configuration. Any time you use a GUI to change a plain-text configuration file (as you do with SWAT), you may lose some of the information that you put in by hand. In this case, SWAT deletes comment lines and rearranges other entries. To protect changes you have made manually, make a backup copy of your /etc/samba/smb.conf file before you edit it with SWAT. Creating Global Samba Settings in SWAT A group of global settings affects how file and print sharing are generally accomplished on a Samba server. These settings appear under the [global] heading in the /etc/samba/smb.conf file. To view and edit global variables, click the GLOBALS button on the SWAT window. Seven types of options are available: base, security, logging, tuning, printing, browse, and WINs. Each option relates to the exact parameters used in the /etc/samba/smb.conf file. You can refer to the smb.conf man page (type man smb.conf) to get more information on these parameters. Note Caution
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Chapter 27 . Running a File Servers (Kids web site) 733

Tuesday, October 30th, 2007

Chapter 27 . Running a File Servers 733 Here s how to set up SWAT in Fedora Core and other Red Hat Linux systems: 1. Turn on the SWAT service by typing the following, as root user, from a Terminal window: # chkconfig swat on 2. Pick up the change to the service by restarting the xinetd startup script as follows: # service xinetd restart Linux distributions such as Debian, Slackware, and Gentoo turn on the SWAT service from the inetd superserver daemon. After SWAT is installed, you simply remove the comment character from in front of the swat line in the /etc/inetd.conf file (as root user, using any text editor) and restart the daemon. Here s an example of what the swat line looks like in Debian: swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/swat With the SWAT service ready to be activated, restart the inetd daemon so it rereads the inetd.conf file. To do that in Debian, type the following as root user: # /etc/init.d/inetd restart The init.d script and xinetd services are the two ways that SWAT services are generally started in Linux. So if you are using a Linux distribution other than Fedora or Debian, look in the /etc/inetd.conf file or /etc/xinetd.d directory (which is used automatically in Fedora), for the location of your SWAT service. When you have finished this procedure, a daemon process will be listening on your network interfaces for requests to connect to your SWAT service. You can now use the SWAT program, described in the next section, to configure Samba. Starting with SWAT You can run the SWAT program by typing the following URL in your local browser: http://localhost:901/ Enter the root username and password when the browser prompts you. The SWAT window (see Figure 27-2) appears. Instead of running SWAT from your local browser, you can run it from another computer on the network by substituting the server computer s name for localhost. (To allow computers besides localhost to access the swat service on Fedora systems, you must change or remove the only_from = 127.0.0.1 line from the /etc/xinetd.d/swat file and restart the xinetd service.) Tip
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

732 Part V . Running Servers . Debian To (Web host server)

Monday, October 29th, 2007

732 Part V . Running Servers . Debian To use Samba in Debian, you must install the samba and smbclient packages using apt-get. Then start the Samba service by running the appropriate scripts from the /etc/init.d directory, as follows: # apt-get install samba samba-common smbclient swat # /etc/init.d/samba start # /etc/init.d/smb-client start . Gentoo With Gentoo, you need to have configured net-fs support into the kernel to use Samba server features. Installing the net-fs package (emerge net-fs) should get the required packages. To start the service, run rc-update and start the service immediately: # emerge samba # rc-update add samba default # /etc/init.d/samba start . Fedora Core and other Red Hat Linux systems You need to install the samba, samba-client, samba-common, and optionally, the system-config-samba and samba-swat packages to use Samba in Fedora. You can then start Samba using the service and chkconfig commands as follows: # service smb start # chkconfig smb on The commands and configuration files are the same on most Linux systems using Samba. The Samba project itself comes with a Web-based interface for administering Samba called Samba Web Administration Tool (SWAT). For someone setting up Samba for the first time, SWAT is a good way to get it up and running. If your Linux installation does not have help documents for Samba available, consult the documentation on the Samba project home page (www.samba.org). Also, check the extensive help information that comes with SWAT. Configuring Samba with SWAT In addition to offering an extensive interface to Samba options, SWAT also comes with an excellent help facility. And if you need to administer Samba from another computer, SWAT can be configured to be remotely accessible and secured by requiring an administrative login and password. Turning on the SWAT Service Before you can use SWAT, you must do some configuration. The first thing you must do is turn on the SWAT service, which is done differently in different Linux distributions. Note
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Chapter 27 . Running a File Servers 731 (Photography web hosting)

Sunday, October 28th, 2007

Chapter 27 . Running a File Servers 731 The Samba software package contains a variety of daemon processes, administrative tools, user tools, and configuration files. To do basic Samba configuration, start with the Samba Server Configuration window, which provides a graphical interface for configuring the server and setting directories to share. Most of the Samba configuration you do ends up in the /etc/samba/smb.conf file. If you need to access features that are not available through the Samba Server Configuration window, you can edit /etc/samba/smb.conf by hand or use SWAT, a Web-based interface, to configure Samba. Daemon processes consist of smbd (the SMB daemon) and nmbd (the NetBIOS name server). The smbd daemon makes the file-sharing and printing services you add to your Linux system available to Windows client computers. The Samba package supports the following client computers: . Windows 9x . Windows NT . Windows ME . Windows 2000 . Windows XP . Windows for workgroups . MS Client 3.0 for DOS . OS/2 . Dave for Macintosh computers . Samba for Linux As for administrative tools for Samba, you have several shell commands at your disposal: testparm and testprns, with which you can check your configuration files; smbstatus, which tells you what computers are currently connected to your shared resources; and the nmblookup command, with which you can query computers. Samba uses the NetBIOS service to share resources with SMB clients, but the underlying network must be configured for TCP/IP. Although other SMB hosts can use TCP/IP, NetBEUI, and IPX/SPX to transport data, Samba for Linux supports only TCP/IP. Messages are carried between host computers with TCP/IP and are then handled by NetBIOS. Getting and Installing Samba You can get Samba software in different ways, depending on your Linux distribution. Here are a few examples:
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Hosting your own web site - 730 Part V . Running Servers mount /home

Saturday, October 27th, 2007

730 Part V . Running Servers mount /home on the same mount point on each client computer. When the user logs in, she has access to all of the startup files and data files contained in her /home/user directory. If your users rely on a shared /home directory, you should make sure that the NFS server that exports the directory is fairly reliable. If /home isn t available, the user may not have the startup files to log in correctly, or any of the data files needed to get work done. One workaround is to have a minimal set of startup files (.bashrc, .Xdefaults, and so on) available in the user s home directory when the NFS directory is not mounted. This enables the user to log in properly at those times. . /project Although you don t have to use this name, a common practice among users on a project is to share a directory structure containing files that people on the project need to share so that everyone can work on original files and keep copies of the latest versions in one place. (Of course, a better way to manage a project is with CVS or some other version control type software, but this is a poor person s way to do it.) . /var/log An administrator can keep track of log files from several different computers by mounting the /var/log file on the administrator s computer. (Each server may need to export the directory to enable root to be mapped between the computers for this to work.) If there are problems with a computer, the administrator can then easily view the shared log files live. If you are working exclusively with Linux and other UNIX systems, NFS is probably your best choice for sharing file systems. If your network consists primarily of Microsoft Windows computers or a combination of systems, you may want to look into using Samba for file sharing. Setting Up a Samba File Server Samba is a software package that enables you to share file systems and printers on a network with computers that use the Session Message Block (SMB) protocol. This package is distributed with most Linux flavors but can be obtained from www.samba .org if you do not find it on your distribution. SMB is the protocol that is delivered with Windows operating systems for sharing files and printers. Although you can t always count on NFS being installed on Windows clients (unless you install it yourself), SMB is always available (with a bit of setup). In Windows file and printer sharing, SMB is sometimes referred to as CIFS (Common Internet File System), which is an Internet standard network file system definition based on SMB, or NetBIOS, which was the original SMB communication protocol. Note Tip
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Chapter 27 . Running a File Servers (Web hosting e commerce) 729

Saturday, October 27th, 2007

Chapter 27 . Running a File Servers 729 Unmounting NFS File Systems After an NFS file system is mounted, unmounting it is simple. You use the umount command with either the local mount point or the remote file system name. For example, here are two ways you could unmount maple:/tmp from the local directory /mnt/maple. # umount maple:/tmp # umount /mnt/maple Either form works. If maple:/tmp is mounted automatically (from a listing in /etc/ fstab), the directory will be remounted the next time you boot Linux. If it was a temporary mount (or listed as noauto in /etc/fstab), it won t be remounted at boot time. The command is umount, not unmount. This is easy to get wrong. If you get the message device is busy when you try to unmount a file system, it means the unmount failed because the file system is being accessed. Most likely, one of the directories in the NFS file system is the current directory for your shell (or the shell of someone else on your system). The other possibility is that a command is holding a file open in the NFS file system (such as a text editor). Check your Terminal windows and other shells, and cd out of the directory if you are in it, or just close the Terminal windows. If an NFS file system won t unmount, you can force it (umount -f /mnt/maple) or unmount and clean up later (umount -l /mnt/maple). The -l option is usually the better choice because a forced unmount can disrupt a file modification that is in progress. Other Cool Things to Do with NFS You can share some directories to make it convenient for a user to work from any of several different Linux computers on your network. Some examples of useful directories to share are: . /var/spool/mail By sharing this directory from your mail server and mounting it on the same directory on other computers on your network, users can access their mail from any of those other computers. This saves users from having to download messages to their current computers or from having to log in to the server just to get mail. There is only one mailbox for each user, no matter from where it is accessed. . /home This is a similar concept to sharing mail, except that all users have access to their home directories from any of the NFS clients. Again, you would Tip
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Professional web hosting - 728 Part V . Running Servers The following

Friday, October 26th, 2007

728 Part V . Running Servers The following steps explain how to turn on the autofs facility: 1. As root user from a Terminal window, open the /etc/auto.master file and uncomment the last line, so it appears as follows: /net /etc/auto.net This causes the /net directory to act as the mount point for the NFS shared directories you want to access on the network. 2. Start the autofs service by typing the following as root user: # /etc/init.d/autofs start 3. On a Fedora system, set up the autofs service to restart every time you boot your system: # chkconfig autofs on Believe it or not, that s all you have to do. If you have a network connection to the NFS servers from which you want to share directories, try to access a shared NFS directory. For example, if you know that the /usr/local/share directory is being shared from the computer on your network named shuttle, you can do the following: $ cd /net/shuttle If that computer has any shared directories that are available to you, you can successfully change to that directory. You also can type the following: $ ls usr You should be able to see that the usr directory is part of the path to a shared directory. If there were shared directories from other top-level directories (such as /var or /tmp), you would see those as well. Of course, seeing any of those directories depends on how security is set up on the server. Try going straight to the shared directory as well. For example: $ cd /net/shuttle/usr/local/share $ ls info man music television At this point, the ls should reveal the contents of the /usr/local/share directory on the computer named shuttle. What you can do with that content depends on how it was configured for sharing by the server.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Chapter 27 . Running a File Servers 727 (Tomcat web server)

Thursday, October 25th, 2007

Chapter 27 . Running a File Servers 727 . wsize The number of bytes of data written at a time to an NFS server. The default is 1,024. Performance issues are the same as with the rsize option. . timeo=# Sets the time after an RPC timeout occurs that a second transmission is made, where # represents a number in tenths of a second. The default value is seven-tenths of a second. Each successive timeout causes the timeout value to be doubled (up to 60 seconds maximum). Increase this value if you believe that timeouts are occurring because of slow response from the server or a slow network. . retrans=# Sets the number of minor timeouts and retransmissions that need to happen before a major timeout occurs. . retry=# Sets how many minutes to continue to retry failed mount requests, where # is replaced by the number of minutes to retry. The default is 10,000 minutes (which is about one week). . bg If the first mount attempt times out, try all subsequent mounts in the background. This option is very valuable if you are mounting a slow or sporadically available NFS file system. By placing mount requests in the background, your system can continue to mount other file systems instead of waiting for the current one to complete. If a nested mount point is missing, a timeout to allow for the needed mount point to be added occurs. For example, if you mount /usr/trip and /usr/trip/ extra as NFS file systems and /usr/trip is not yet mounted when /usr/ trip/extra tries to mount, /usr/trip/extra will time out. If you re lucky, /usr/trip comes up and /usr/trip/extra mounts on the next retry. . fg If the first mount attempt times out, try subsequent mounts in the foreground. This is the default behavior. Use this option if it is imperative that the mount be successful before continuing (for example, if you were mounting /usr). Any of the options that don t require a value can have no appended to it to have the opposite effect. For example, nobg indicates that the mount should not be done in the background. Using autofs to Mount NFS File Systems on Demand With the autofs facility configured and turned on, you can cause any NFS shared directories to mount on demand. To use the autofs facility, you need to have the autofs package installed. (For Fedora, you can type yum install autofs or for Debian type apt-get install autofs to install the package from the network.) With autofs enabled, if you know the host name and directory being shared by another host computer, simply change (cd) to the autofs mount directory (/net by default). This causes the shared resource to be automatically mounted and made accessible to you. Note
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

726 Part V . Running Servers Mounting noauto (Apache web server for windows)

Wednesday, October 24th, 2007

726 Part V . Running Servers Mounting noauto File Systems Your /etc/fstab file contains devices for other file systems that are not mounted automatically (probably /dev/cdrom and /dev/fd0, for your CD-ROM and floppy disk devices, respectively). The noauto option for these devices is what prevents them from being mounted at boot time. A noauto file system can be mounted manually when you need it. The advantage is that when you type the mount command, you can type less information and have the rest filled in by the contents of the /etc/ fstab file. For example, you can type: # mount /oak/apps With this command, mount knows to check the /etc/fstab file to get the file system to mount (oak:/apps), the file system type (nfs), and the options to use with the mount (in this case ro for read-only). Instead of typing the local mount point (/oak/apps), you could have typed the remote file system name (oak:/apps) and had other information filled in. When naming mount points, including the name of the remote NFS server in that name can help you remember where the files are actually being stored. This may not be possible if you are sharing home directories (/home) or mail directories (/var/spool/mail). For example, you might mount a file system from a machine called duck on the directory /mnt/duck. Using mount Options You can add several mount options to the /etc/fstab file (or to a mount command line itself) to influence how the file system is mounted. When you add options to /etc/fstab, they must be separated by commas. For example, here, the noauto, ro, and hard options are used when oak:/apps is mounted: oak:/apps /oak/apps nfs noauto,ro,hard 0 0 The following are some options that are valuable for mounting NFS file systems: . hard If this option is used and the NFS server disconnects or goes down while a process is waiting to access it, the process will hang until the server comes back up. This is helpful if it is critical that the data you are working with not get out of sync with the programs that are accessing it. (This is the default behavior.) . soft If the NFS server disconnects or goes down, a process trying to access data from the server will time out after a set period of time when this option is on. An input/output error is delivered to the process trying to access the NFS server. . rsize The number of bytes of data read at a time from an NFS server. The default is 1024. Using a larger number (such as 8192) will get you better performance on a network that is fast (such as a LAN) and is relatively error-free (that is, one that doesn t have a lot of noise or collisions). Tip
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Web hosts - Chapter 27 . Running a File Servers 725

Tuesday, October 23rd, 2007

Chapter 27 . Running a File Servers 725 . -a Mount all file systems in /etc/fstab (except those indicated as noauto). . -f This goes through the motions of (fakes) mounting the file systems on the command line (or in /etc/fstab). Used with the -v option, -f is useful for seeing what mount would do before it actually does it. . -r Mounts the file system as read-only. . -w Mounts the file system as read/write. (For this to work, the shared file system must have been exported with read/write permission.) The next section describes how to make the mount more permanent (using the /etc/fstab file) and how to select various options for NFS mounts. Automatically Mounting an NFS File System To set up an NFS file system to mount automatically each time you start your Linux system, you need to add an entry for that NFS file system to the /etc/fstab file. That file contains information about all different kinds of mounted (and available to be mounted) file systems for your system. Here s the format for adding an NFS file system to your local system: host:directory mountpoint nfs options 0 0 The first item (host:directory) identifies the NFS server computer and shared directory. mountpoint is the local mount point on which the NFS directory is mounted. It s followed by the file system type (nfs). Any options related to the mount appear next in a comma-separated list. (The last two zeros configure the system to not dump the contents of the file system and not to run fsck on the file system.) The following are examples of NFS entries in /etc/fstab: maple:/tmp /mnt/maple nfs rsize=8192,wsize=8192 0 0 oak:/apps /oak/apps nfs noauto,ro 0 0 In the first example, the remote directory /tmp from the computer named maple (maple:/tmp) is mounted on the local directory /mnt/maple (the local directory must already exist). The file system type is nfs, and read (rsize) and write (wsize) buffer sizes (discussed in the Using mount Options section later in this chapter) are set at 8192 to speed data transfer associated with this connection. In the second example, the remote directory is /apps on the computer named oak. It is set up as an NFS file system (nfs) that can be mounted on the /oak/apps directory locally. This file system is not mounted automatically (noauto), however, and can be mounted only as read-only (ro) using the mount command after the system is already running. The default is to mount an NFS file system as read/write. However, the default for exporting a file system is read-only. If you are unable to write to an NFS file system, check that it was exported as read/write from the server. Tip
In case you need quality webspace to host and run your web applications, try our personal web hosting services.