Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Servers and Workstations: Managing Systems and Workgroups > Chapter 4 Configuring a Workgroup

Sharing Files and Applications via NFS and ftp

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

This section provides procedures and troubleshooting information for Network File System (NFS) and File Transfer Protocol (ftp).

  • NFS allows a computer access to a file system that resides on another computer’s disks, as though the file system were mounted locally.

    The NFS server is the computer to which the disk is physically attached; computers that use the file system remotely are called NFS clients. Before NFS clients can mount (import) a file system that resides on the NFS server’s disks, the NFS server must export it.

    Before you can import and export file systems, you must install and configure NFS software on both the server and client systems. In most cases this will have been done when the systems were installed. Use the manual Installing and Administering NFS Services if you need to install NFS.

    For information and guidelines on planning the workgroup’s file-sharing configuration, see “Distributing Applications and Data”.

  • ftp is a mechanism for copying files from one system to another.

This section contains information on the following:

See also:

Exporting a File System (HP-UX to HP-UX)

Use either of the following procedures to set up NFS exports on the server.

Using SAM to Export a File System

  1. Log in to the server as root.

  2. Run SAM: enter

    sam

    on the command line.

  3. Enable NFS if necessary:

    Choose Networking and Communications/Network Services/NFS Server. Pull down the Actions menu and choose Enable.

  4. Choose Networking and Communications/Networked File Systems/Exported Local File Systems. Pull down the Actions menu and choose Add Exported File System

  5. Fill in the fields identifying the file systems to be exported and the systems that can import them. Use SAM’s online help if necessary.

The exported file system should now be listed in the /etc/exports file.

Using the Command Line to Export a File System

  1. Log into the server as root.

  2. If the system is not already configured as an NFS server:

    1. Edit /etc/rc.config.d/nfsconf, changing the values for NFS_SERVER and START_MOUNTD to 1.

    2. Run the nfs.server script:

      /sbin/init.d/nfs.server start
  3. Edit /etc/exports, adding an entry for each directory that is to be exported. The entry identifies the directory and (optionally) the systems that can import it. The entry should look something like this:

    /opt/netscape async,anon=65534,access=wsb2600:appserver:wsb2600:wszx6
    NOTE: If no systems are specified for a particular file system, then all systems have permission to import the file system; if any systems are listed, then only those systems can import the file system.

    See exports(4) for more information.

  4. Force the NFS daemon (nfsd) to re-read /etc/exports.

    /usr/sbin/exportfs -a

Importing a File System (HP-UX to HP-UX)

Before you begin, you need to:

  • Check that the directory you are importing to either:

    • Does not already exist on the local (client) system; or

    • Is empty; or

    • Contains data that will not be needed so long as the remote directory is mounted.

      In this case, make sure that no one has open files in the local directory and that it is not anyone’s current working directory. For example, if you intend to import to a directory named /mydir, on the client, enter:

      fuser -cu /mydir
      NOTE: Files in the local directory will be overlaid, but not overwritten, when you import the remote directory. The local files will be accessible again once you unmount the remote directory.
  • Make sure that the client has permission to import the file system from the server.

    This requires an entry in /etc/exports on the server; see Step 3 under “Using the Command Line to Export a File System”.

  • Decide whether you want this mount to be (see Table 4-1 “Deciding Which type of NFS Mount to Use”):

    • An ordinary NFS mount

    • An automatically mounted NFS file system

      • Mounted using Automounter

      • Mounted using AutoFS

Use either of the following procedures to import a file system.

NOTE: SAM does not currently support AutoFS. For importing using AutoFS, please see Chapter 2 in the manual Installing and Administering NFS Services.

Using SAM to Import a File System

  1. Log in to the client as root.

  2. Run SAM. Enter:

    sam

    on the command line.

  3. Enable NFS client services if necessary:

    Choose “Networking and Communications/Network Services/NFS Client”, then pull down the “Actions” menu and choose “Enable”.

  4. Choose “Networking and Communications/Networked File Systems/Mounted Remote File Systems”, then pull down the “Actions” menu and choose “Add Remote File Systems.

  5. Fill in the fields identifying the directories to be imported.

    You can use ordinary NFS or the NFS Automounter.

    • If you use the Automounter, the file system will be mounted on the client only when a user or process requests access to it, and will be unmounted after it has remained untouched for five minutes.

    • If you use the Automounter -hosts Map, SAM will create a directory (/net by default) under which all the file systems (on any host on the network) which this client is allowed to import, become available on demand.

    For more information, choose “Explain Automounter” under “Add Remote File System ”in SAM, or see the automount(1M) manpage.

    Fill in the SAM fields identifying the directories to be imported. Use SAM’s online help if you need to.

    NOTE: You do not have to call the directory on the client by the same name it has on the server, but it will make things simpler (more transparent) for your users if you do. If you are running applications configured to use specific path names, you must make sure those path names are the same on every system on which the applications run.

Using the Command Line to Import a File System

Before you start: make sure the client is configured to import file systems via NFS. The simplest method is to use SAM; see Step 3 under “Using SAM to Import a File System”.

  1. Log in to the client as root.

  2. Create the local directory on the client if it does not exist, for example:

    mkdir /opt/adobe
    NOTE: If the directory does exist, its contents will be hidden when you mount the remote directory, and will not be usable until you unmount it.
  3. Add an entry to /etc/fstab so the file system will be automatically mounted at boot-up.

    nfs_server:/nfs_server_dir /client_dir  nfs defaults 0 0

    For example:

    fancy:/opt/adobe /opt/adobe nfs defaults 0 0
  4. Mount the remote file system.

    The following command forces the system to reread /etc/fstab and mount all the file systems:

    /usr/sbin/mount -a

Importing HP-UX Directories to NT

You can use either the HP CIFS/9000 product or other third-party products to have access to PC file systems.

CIFS/9000

CIFS/9000 provides HP-UX with a distributed file system based upon Microsoft’s CIFS (Common Internet File System) protocol, also known as the SMB (Server Message Block) protocol. The SMB protocol is the native file-sharing protocol in Microsoft Windows and OS/2 operating systems and is the standard way that millions of PC users share files across corporate intranets.

CIFS/9000 implements both the server and client components of the CIFS protocol on HP-UX. This means that HP-UX file systems can be mounted onto Window systems and Window file systems can be mounted onto HP-UX systems.

The CIFS/9000 Server is based upon Samba and provides file as well as print services to CIFS clients including Windows NT, XP, 2000 and other HP-UX machines running the CIFS/9000 Client software.

The CIFS/9000 Client enables HP-UX users to mount as UNIX file systems PC shares from CIFS files servers including Window servers and HP-UX machines running the CIFS/9000 Server software. The CIFS/9000 client also offers an optional Pluggable Authentication Module (PAM) that implements the Windows NTLM authentication protocols. When installed and configured within HP-UX’s PAM facility, this allows HP-UX users to be authenticated against a Windows authentication server.

For information on CIFS/9000, including detailed usage on HP-UX, see the manuals Installing and Administering the CIFS/9000 Server and Installing and Administering the CIFS/9000 Client, both available at http://docs.hp.com.

Third-Party Products

Microsoft Windows NT does not include a native NFS function, but several good third-party products make it easy to export HP-UX file systems to an NT workstation.

The quick reference that follows uses the DiskAccess product, Microsoft Windows/NT Workstation 4.0, and HP-UX 10.x or later. It assumes that you are using Domain Name Service (DNS) for network routing.

NOTE: A DiskAccess evaluation package is supplied with HP Vectra XW Graphics workstations as of May 2, 1997. For other systems, a free one-month evaluation package is available on the Web at http://www.ssc-corp.com/nfs.
Installation

Install DiskAccess from CD onto the NT workstation and follow prompts. Reboot the workstation when directed to do so.

Exporting a File System from an HP-UX Server

Do the following on the HP-UX server.

  1. Configure the HP-UX system as an NFS server; see “Exporting a File System (HP-UX to HP-UX)”.

  2. Make sure that the pcnfsd daemon is configured to start on boot in /etc/rc.config.d/nfsconf (PCNFS_SERVER should be set to 1).

    If necessary, edit /etc/rc.config.d/nfsconf changing the line

     PCNFS_SERVER=0

    to

     PCNFS_SERVER=1
  3. Make sure that pcnfsd is running:

    ps -ef | grep pcnfsd

    If pcnfsd is not running, start it:

    /usr/sbin/rpc.pcnfsd

    See pcnfsd(1M) for more information

  4. Make sure that the directories to be exported are listed in /etc/exports, and:

    • either

      The NT client’s host name is listed among the systems that have access to each directory

    • or

      No systems are listed for the directories.

    CAUTION: If you dial in to the server using a variable IP address for the NT client, and the server lists the client’s host name explicitly in /etc/exports, the lookup will fail because the IP address will not match. You need to export the directory without restrictions (no host names in /etc/exports).

    If you modified /etc/exports, force the system to re-read it:

    /usr/sbin/exportfs -a

Now do the following on the NT Client.

  1. Choose “Control Panel--DiskAccess--Authentication”.

    1. Enter a user name and password valid on the HP-UX server.

    2. Check the box for “PCNFSD Server” and enter the host name of the HP-UX server.

    3. Click on “Filenames” in the “DiskAccess Control Panel” and select “Preserve Case”.

  2. Choose “Start--Programs--NT Explorer--Tools--Map Network Drive

    1. Enter the NT drive name or accept the default.

    2. Enter the HP-UX server’s hostname:/pathname, (or enter hostname only to see a list of the file systems the server exports).

    3. Click on OK.

Troubleshooting NFS

Table 4-2 Title not available (Troubleshooting NFS)

ProblemWhat To Do
Individual client can’t import from one or more servers

Check the following on the client:

  • Verify that the local directory exists on the client. If it does not exist, create it using mkdir. For example:

    mkdir /opt/adobe

  • LAN cable intact and connected, and all connections are live.

  • /etc/hosts exists and has “Requisite Entries”.

  • /etc/fstab exists and has “Requisite Entries”, and the entries still point to valid directories on the server.

  • /etc/resolv.conf exists and has “Requisite Entries” (DNS only)

  • /etc/rc.config.d/nfsconf has NFS_CLIENT=1

    Check the file directly, or check in SAM that NFS_CLIENT is enabled (see “Using SAM to Import a File System”).

Check on the servers that the directories the client is trying to import exist and are listed in /etc/exports, and that the client has permission to import them. See Step 3 under “Using the Command Line to Export a File System”.

All clients can’t import from a given server

Do the following on the server:

  • Check that the server is up and running, and that the LAN connection between the server and clients is live (can you “ping” the clients from the server and vice versa?)

    Check that rpc.mountd is running:

    ps -ef | grep rpc.mountd

    If rpc.mountd is not running (symptom RPC-PROG NOT REGISTERED), run it:

    /usr/sbin/rpc.mountd 
  • Check that nfsd is running:

    ps -ef | grep nfsd

    If nfsd is not running, run it:

    /usr/sbin/nfsd  
  • Check that /etc/rc.config.d/nfsconf has NFS_SERVER=1 and START_MOUNTD=1, or check in SAM that “NFS Server” is enabled (see “Using SAM to Export a File System”).

  • Check that the file systems that the clients are trying to mount are listed in /etc/exports. Check /etc/exports directly or check in SAM (see “Using SAM to Export a File System”).

All clients can’t import from a given server (cont’d)

On the server (cont’d):

  • exportfs -a 

    (to force the server to re-read /etc/exports and export the file systems specified in it).

  • Run SAM and get into the “Services Enable/Disable” menu under “Networking/Communications”, click on “NFS Server” and choose “Restart” from the pull-down menu.

  • If these remedies fail, and the configuration looks good (all the checks above), then the server may not have booted correctly; try rebooting the server.

Stale NFS file handle

(Common on NFS clients after server has crashed, or been rebooted before clients have unmounted NFS file systems, or after /etc/exports has been changed on the server).

On the client(s):

  • Check that there are no open files in the affected file systems, then try unmounting and remounting them.

    Try this first if /etc/exports has been changed on the server (directly or via SAM).

On the server:

  • exportfs -a

    Try this first if server has just rebooted.

On an NFS server, umount fails.
  • Check that all files are closed in the file system to be unmounted, and that it is not anyone’s working directory, on the system (host) from which it is to be unmounted. Note that although fuser(1M) can be used to check for open files, it is not able to detect files in a different directory opened within an editor.

  • Try this if the directory is exported:

    exportfs -u dir

 

Requisite Entries

The following entries are required in /etc/hosts, /etc/fstab, and /etc/resolv.conf:

  • /etc/hosts:

    • System host name and IP address, for example:

      12.0.14.123 fredsys fredsys.mysite.myco.com
    • An entry similar to the following:

      127.0.0.1   localhost    loopback #[no SMTP]
  • /etc/fstab:

  • /etc/resolv.conf (needed for Domain Name Service [DNS] only):

    • The name of the domain in which this system resides, for example:

      domain mysite.myco.com
    • At least one name server, for example:

      nameserver 12.0.14.165

Recovering Network Services after a Power Failure

This section describes how to troubleshoot problems you and your workstation users are likely to encounter when rebooting after a general power failure or outage. The examples assume you are using DNS (Domain Name Service).

Symptoms and Keywords

RPC_PROG_NOT_REGISTERED

name_server

rcmd: hostname: Unknown host

rcmd: hostname: Not in database

rcmd: hostname: Access denied

What To Do

A. When the Domain Name Server Goes Down 

If a system powers up before the Domain Name Server does, it will not find the name server and you will get the message:

rcmd: hostname: Unknown host

when the user tries to reach another system.

The simplest solution is to reboot the system after the name server has been rebooted.

B. When a Client Can’t Import Directories from a Server

Do the troubleshooting checks described under “Troubleshooting NFS”. If these fail, and the client is getting messages such as:

rcmd: hostname: Not in database
rcmd: hostname: Access denied

then do the following procedure on the server:

  1. Log in as superuser.

  2. Start SAM.

  3. Select “Networking and Communications/Network Services/NFS Server”.

    Pull down the “Actions” menu and choose “Restart” or “Enable”.

  4. Select “NFS Client”.

  5. Pull down the “Actions” menu and choose “Restart” or “Enable”.

  6. Exit SAM.

  7. Execute /usr/sbin/exportfs -a.

Now do the following procedure on the client:

  1. Run SAM.

  2. Select “Networking and Communications--Network Services--NFS Client”.

    Pull down the “Actions” menu and choose “Restart” or “Enable”.

Moving or Reusing an Exported Directory

If you rename an NFS-mounted directory, NFS clients must unmount and remount the imported directory before they can see the new contents.

For example, if a server is exporting /opt/myapp, and you move /opt/myapp to /opt/myapp.old then rebuild and repopulate /opt/myapp, all the NFS clients must unmount and remount the directory, for example (as superuser on each client):

umount /opt/myapp
mount -a

Any client on which this is not done will continue to see the former contents of /opt/myapp, that is /opt/myapp.old.

You can encounter the same problem in a slightly different way when you reuse an LVM volume.

For example, suppose you unmount an obsolete file system named /projects from a file server named fp_server, and subsequently reuse the logical volume, mounting a file system /newprojects on it.

Any client that fails to unmount /projects will see the contents of fp_server:/newprojects, labeled /projects.

Configuring Anonymous ftp

Anonymous ftp allows users who do not have an account on a given system to send files to, and retrieve them from, that system.

  1. Add user ftp to /etc/passwd, for example:

    ftp:*:500:1:anonymous ftp:/home/ftp:/usr/bin/false

    The password field should be *, the group membership should be guest, or, as in this example, other, and the login shell should be /usr/bin/false.

    In this example, user ftp’s user ID is 500, and the anonymous ftp directory is /home/ftp.

  2. Create the anonymous ftp directory:

    1. Create the ftp home directory that you referred to in the /etc/passwd file, for example:

      mkdir /home/ftp

    2. Create the subdirectory /usr/bin under the ftp home directory, for example:

      cd /home/ftp
      mkdir usr
      cd usr
      mkdir bin

  3. Copy the ls and pwd commands from /sbin and /usr/bin (respectively) to ~ftp/usr/bin, and set the permissions on the commands to executable only (mode 0111):

    cp /sbin/ls /home/ftp/usr/bin
    cp /usr/bin/pwd /home/ftp/usr/bin
    chmod u=x,g=x,o=x /home/ftp/usr/bin/ls
    chmod u=x,g=x,o=x /home/ftp/usr/bin/pwd

  4. Set the owner of the ~ftp/usr/bin and ~ftp/usr directories to root, and set the permissions to not writable (mode 0555):

    chown root /home/ftp/usr/bin
    chmod u=rx,g=rx,o=rx /home/ftp/usr/bin
    chown root /home/ftp/usr
    chmod u=rx,g=rx,o=rx /home/ftp/usr

  5. Create the subdirectory etc under the ftp directory, for example:

    cd /home/ftp
    mkdir etc

  6. Copy /etc/passwd and /etc/group to ~ftp/etc.

    These files are required by the ls command, to display the owners of files and directories under ~ftp.

    cp /etc/passwd /home/ftp/etc
    cp /etc/group /home/ftp/etc

  7. In all entries in /home/ftp/etc/passwd, replace the password field with an asterisk (*), and delete the shell field, for example:

    ftp:*:500:1:anonymous ftp:/home/ftp:
    tom:*:8996:20::/home/tom:

  8. In all entries in /home/ftp/etc/group, replace the password field with an asterisk (*):

    users:*:20:acb
    guest:*:21:ftp

  9. Change the owner of the files in ~ftp/etc to root, and set the permissions to read only (mode 0444):

    chown root /home/ftp/etc
    chmod u=r,g=r,o=r /home/ftp/etc

  10. Create a directory pub under ~ftp, and change its owner to user ftp and its permissions to writable by all (mode 0777).

    Anonymous ftp users can put files in this directory to make them available to other anonymous ftp users.

    mkdir /home/ftp/pub
    chown ftp /home/ftp/pub
    chmod u=rwx,g=rwx,o=rwx /home/ftp/pub

  11. Create a directory dist under ~ftp. Change its owner to root and its permissions to writable only by root (mode 0755).

    mkdir /home/ftp/dist
    chown root /home/ftp/dist
    chmod u=rwx,g=rx,o=rx /home/ftp/dist

  12. Change the owner of user ftp’s home directory to root and the permissions to not writable (mode 0555):

    chown root /home/ftp
    chmod u=rx,g=rx,o=rx /home/ftp

Troubleshooting ftp login

Symptom:   Some or all users can’t ftp to an HP-UX system.

NOTE: If no users can ftp to a given system, check first of all that inetd is running on that system:

ps -ef | grep inetd

If inetd is not running, start it:

/usr/sbin/inetd

It is also possible that the ftp service is disabled. Check /etc/inetd.conf for the following line:

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l

If this line does not exist, or is commented out (preceded by a pound sign, (#) add it (or remove the pound sign) and restart inetd:

/usr/sbin/inetd -c

You can also use SAM to check for the status of ftp and enable it if necessary: go to Networking and Communications/Network Services.

Problem: ftp calls getusershell which by default checks password information (that is, the entry in /etc/passwd for the user who is trying to log in) against a fixed list. If the shell isn’t on the list, ftp won’t let the user in, so if you use an unusual shell you may not be able to ftp even to your own system.

getusershell can be made aware of other shells via /etc/shells; see “Fix 2”.

Fix 1

Convert all /bin/shell to /usr/bin/shell in /etc/passwd.

Fix 2

Create /etc/shells on the system that is rejecting ftp logins and list all the shells that appear in /etc/passwd.

For more information see: getusershell(3C), shells(4).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1997-2006 Hewlett-Packard Development Company, L.P.