Archive for October, 2007

Chapter 26 . Running a File Server (Http web server) 675

Saturday, October 13th, 2007

Chapter 26 . Running a File Server 675 Windows 9x Windows for Workgroups Windows NT MS Client 3.0 for DOS Windows ME OS/2 Windows 2000 Dave for Macintosh Computers Windows XP 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 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: . 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 NFS file system and NFS server support into the kernel to use NFS server features. Installing the nfs-utils package (emerge nfs-utils) 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
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

674 Part V . Running Servers . /project Although (Sri lanka web server)

Friday, October 12th, 2007

674 Part V . Running Servers . /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. 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: Note
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Chapter 26 . Running a (Anonymous web server) File Server 673

Thursday, October 11th, 2007

Chapter 26 . Running a File Server 673 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 consistent 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 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. Tip Tip
You want to have a cheap webhost for your apache application, then check apache web hosting services.

672 Part V . Running Servers 2. Start

Wednesday, October 10th, 2007

672 Part V . Running Servers 2. Start the autofs service by typing the following as root user: # service autofs start 3. 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 could 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 could 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 that it was configured for sharing by the server. 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
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Chapter 26 (Web host) . Running a File Server 671

Tuesday, October 9th, 2007

Chapter 26 . Running a File Server 671 . 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. Hopefully, /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 values 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. 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) and have the shared resource automatically mount and be accessible to you. 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. Note
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Best web design - 670 Part V . Running Servers The default

Monday, October 8th, 2007

670 Part V . Running Servers 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. 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 could 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. The following are some options that are valuable for mounting NFS file systems: . hard If this option is on 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 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). . wsize The number of bytes of data written at a time to an NFS server. The default is 1024. Performance issues are the same as with the rsize option. Tip Tip
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Web design portfolio - Chapter 26 . Running a File Server 669

Sunday, October 7th, 2007

Chapter 26 . Running a File Server 669 This is a simple example of using mount with NFS. The mount is temporary and is not remounted when you reboot your computer. You can also add options for NFS mounts: . -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.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

668 Part V . (Web server application) Running Servers mount can

Sunday, October 7th, 2007

668 Part V . Running Servers mount can automatically mount NFS directories that are added to the /etc/fstab file, just as it does with local disks. NFS directories can also be added to the /etc/ fstab file in such a way that they are not automatically mounted (so you can mount them manually when you choose). With a noauto option, an NFS directory listed in /etc/fstab is inactive until the mount command is used, after the system is up and running, to mount the file system. Manually Mounting an NFS File System If you know that the directory from a computer on your network has been exported (that is, made available for mounting), you can mount that directory manually using the mount command. This is a good way to make sure that it is available and working before you set it up to mount permanently. Here is an example of mounting the /tmp directory from a computer named maple on your local computer: # mkdir /mnt/maple # mount maple:/tmp /mnt/maple The first command (mkdir) creates the mount point directory (/mnt is a common place to put temporarily mounted disks and NFS file systems). The mount command identifies the remote computer and shared file system separated by a colon (maple:/tmp), and the local mount point directory (/mnt/maple) follows. If the mount fails, make sure the NFS service is running on the server and that the server s firewall rules don t deny access to the service. From the server, type ps ax | nfsd to see a list of nfsd server processes. If you don t see the list, try to start your NFS daemons as described in the previous section. To view your firewall rules, type iptables -L (see Chapter 17 for a description of firewalls). By default, the nfsd daemon listens for NFS requests on port number 2049. Your firewall must accept udp requests on ports 2049 (nfs) and 111 (rpc). To ensure that the mount occurred, type mount. This command lists all mounted disks and NFS file systems. Here is an example of the mount command and its output (with file systems not pertinent to this discussion edited out): # mount /dev/hda3 on / type ext3 (rw) … … … maple:/tmp on /mnt/maple type nfs (rw,addr=10.0.0.11) The output from the mount command shows the mounted disk partitions, special file systems, and NFS file systems. The first output line shows the hard disk (/dev/hda3), mounted on the root file system (/), with read/write permission (rw), with a file system type of ext3 (the standard Linux file system type. The just-mounted NFS file system is the /tmp directory from maple (maple:/tmp). It is mounted on /mnt/ maple and its mount type is nfs. The file system was mounted read/write (rw), and the IP address of maple is 10.0.0.11 (addr=10.0.0.11). Note
We recommend high quality webhost to host and run your jsp application: christian web host services.

Web hosting domain - Chapter 26 . Running a File Server 667

Saturday, October 6th, 2007

Chapter 26 . Running a File Server 667 The -a option indicates that all directories listed in /etc/exports should be exported. The -v option says to print verbose output. In this example, the /pub and /home directories from the local server are immediately available for mounting by those client computers that are named (maple and spruce). The /mnt/win directory is available to all client computers. Running the exportfs command temporarily makes your exported NFS directories available. To have your NFS directories available on an ongoing basis (that is, every time your system reboots), you need to set your nfs startup scripts to run at boot time. This is described in the next section. Starting the nfs Daemons If for some reason NFS has been disabled on your system (or is not active by default), you need to start the service. Different Linux distributions have different ways of turning on the NFS service, as you saw in the Getting NFS section earlier in the chapter. This section explores how the service is turned on in Fedora Core and other Red Hat Linux systems. In Fedora, you can use the chkconfig command to turn on the NFS service so that your files are exported and the nfsd daemons are running when your system boots. There are two startup scripts you want to turn on for the service to work properly. The NFS service exports file systems (from /etc/exports) and starts the nfsd daemon that listens for service requests. The nfslock service starts the lockd daemon, which helps allow file locking to prevent multiple simultaneous use of critical files over the network. To turn on the NFS service, type the following as root user: # chkconfig nfs on # chkconfig nfslock on The next time you start your computer, the NFS service will start automatically, and your exported directories will be available. If you want to start the service immediately, without waiting for a reboot, type the following: # /etc/init.d/nfs start # /etc/init.d/nfslock start The NFS service should now be running and ready to share directories with other computers on your network. Using NFS File Systems After a server exports a directory over the network using NFS, a client computer connects that directory to its own file system using the mount command. That s the same command used to mount file systems from local hard disks, CDs, and floppies, but with slightly different options.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

666 Part (Web file server) V . Running Servers . nfsnobody

Friday, October 5th, 2007

666 Part V . Running Servers . nfsnobody user/group By using nfsnobody username and group name, you essentially create a user/group with permissions that do not allow access to files that belong to any real users on the server, unless those users open permission to everyone. However, files created by the nfsnobody user or group are available to anyone assigned as the nfsnobody user or group. To set all remote users to the nfsnobody user/group, use the all_squash option. The nfsnobody user is assigned to UIDs and GIDs of 65534 to prevent the ID from running into a valid user or group ID. Using anonuid or anongid options, you can change the nfsnobody user or group, respectively. For example, anonuid=175 sets all anonymous users to UID 175, and anongid=300 sets the GID to 300. (Only the number is displayed when you list file permission unless you add entries with names to /etc/password and /etc/group for the new UIDs and GIDs.) . User mapping If a user has login accounts for a set of computers (and has the same ID), NFS, by default, maps that ID. This means that if the user named mike (UID 110) on maple has an account on pine (mike, UID 110), he could use his own remotely mounted files on either computer from either computer. If a client user who is not set up on the server creates a file on the mounted NFS directory, the file is assigned to the remote client s UID and GID. (An ls -l on the server shows the UID of the owner.) Use the map_static option to identify a file that contains user mappings. The exports main page describes the map_static option, which enables you to create a file that contains new ID mappings so that you can remap client IDs into different IDs on the server. Exporting the Shared File Systems After you have added entries to your /etc/exports file, run the exportfs command to have those directories exported (made available to other computers on the network). Reboot your computer or restart the NFS service, and the exportfs command runs automatically to export your directories. If you want to export them immediately, run exportfs from the command line (as root). It s a good idea to run the exportfs command after you change the exports file. If any errors are in the file, exportfs will identify them for you. Here s an example of the exportfs command: # /usr/sbin/exportfs -a -v exporting maple:/pub exporting spruce:/pub exporting maple:/home exporting spruce:/home exporting *:/mnt/win Tip Tip
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.