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-UX System Administrator's Guide: Configuration Management: HP-UX 11i Version 3 > Chapter 5 Configuring Networking

Configuring File Transfer Protocol (FTP)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

File Transfer Protocol (FTP) is a mechanism for copying files from one system to another. These sections provide configuration procedures and troubleshooting information.

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.

Configuring Anonymous FTP with Text-Based HP SMH

  1. Log in to the server as superuser.

  2. Start HP SMH; see “Starting Text-Based HP SMH”.

  3. Navigate to Network Services.

    1. Press n, Networking and Communications.

    2. Press s, Network Services Configuration.

    3. Press k, Network Services.

  4. Highlight Anonymous FTP.

  5. Press Tab A to pull down the Actions menu.

  6. Select Enable.

    HP SMH executes commands that create a password entry in the appropriate files, creates the ftp user account, and sets up the needed files and programs.

    The entry in /etc/passwd is usually:

    ftp:*:500:1:Anonymous FTP user:/home/ftp:/usr/bin/false

    The created files and directories are:

    dr-xr-xr-x   6 root       other           96 Oct 29 21:48 /home/ftp
    dr-xr-xr-x   2 root       other           96 Oct 29 21:48 /home/ftp/etc
    -r--r--r--   1 root       other         1272 Oct 29 21:48 /home/ftp/etc/passwd
    -r--r--r--   2 root       other          226 Oct 29 21:48 /home/ftp/etc/group
    -r--r--r--   2 root       other          226 Oct 29 21:48 /home/ftp/etc/logingroup
    dr-xr-xr-x   4 root       other           96 Oct 29 21:48 /home/ftp/usr
    dr-xr-xr-x   2 root       other           96 Oct 29 21:48 /home/ftp/usr/bin
    ---x--x--x   1 root       other       479232 Oct 10 21:39 /home/ftp/usr/bin/ls
    dr-xr-xr-x   2 root       other           96 Oct 29 21:48 /home/ftp/usr/lib
    -r--r--r--   1 root       other        17782 Oct 10 21:43 /home/ftp/usr/lib/tztab
    dr-xr-xr-x   2 root       other           96 Oct 29 21:48 /home/ftp/dist
    drwxrwxrwx   2 ftp        other           96 Oct 29 21:48 /home/ftp/pub

Configuring Anonymous FTP with HP-UX Commands

  1. Add user ftp to /etc/passwd, usually:

    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 ftp home directory:

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

      # mkdir /home/ftp
    2. Create the subdirectories usr/bin and /usr/lib under the ftp home directory, usually:

      # cd /home/ftp # mkdir -p usr/bin
  3. Copy the ls command from /sbin to /home/ftp/usr/bin, and set the permissions on the command to execute only (mode 0111):

    # cp /sbin/ls /home/ftp/usr/bin # chmod u=x,g=x,o=x /home/ftp/usr/bin/ls
  4. Set the owner of the /home/ftp/usr/bin and /home/ftp/usr directories to root, and set the permissions to read-execute (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:

    # cd /home/ftp # mkdir etc
  6. Copy /etc/passwd and /etc/group to /home/ftp/etc.

    These files are required by the ls command, to display the owners of files and directories under /home/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:ftp1
  9. Change the owner of the files in /home/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 (for public) under /home/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

    You can create other directories to provide separate categories, such as /home/ftp/draft and /home/ftp/final.

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

    Anonymous FTP users can read but not alter these directories.

    # 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.

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 HP SMH to check for the status of FTP and enable it if necessary.

  • On text-based HP SMH, navigate to Networking and Communications->Network Services Configuration->Network Services.

  • On web-based HP SMH, navigate to Tools->NetworkServices->ConfigurationNetwork Services.

Setting Up /etc/shells

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. Perform the following steps on the system that is rejecting FTP logins:

  1. If necessary, update all the old-style shell entries in /etc/passwd.

    Convert all /bin/shellname to /usr/bin/shellname.

  2. Create /etc/shells and list all the shells that appear in /etc/passwd.

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

Configuring HP-UX Systems for File Transfer

Transferring files between computers is a common workgroup activity. When you’re mixing HP-UX systems and PCs in a workgroup, network transfers are usually the most efficient, and sometimes the only, way to transfer files from one type of system to another. Many HP-UX systems are not equipped with floppy disk drives, and many PCs are not equipped with DDS drives or other external file storage peripherals often found on HP-UX systems.

FTP (File Transfer Protocol)

One of the utilities/protocols common to both Windows NT and HP-UX systems is FTP (file transfer protocol). FTP is a client/server protocol. The FTP client is the program you run on your local system to communicate with the FTP server on the remote system.

FTP Client Software

On HP-UX systems, the FTP client is the program /usr/bin/ftp. On Microsoft's Windows operating systems you start the FTP client by issuing the ftp command from the command prompt.

FTP Server Software

Shipped as part of Windows operating systems for PCs (but not necessarily installed initially) are a group of utilities collectively known as the “Microsoft Peer Web Services.” One of the services in this collection is an “FTP publishing service” that enables you to ftp files to and from your PC while sitting at one of your HP-UX systems. This service is the FTP server that runs on your PC. On HP-UX systems, the FTP server is the ftpd daemon, started as needed by the inetd daemon when FTP requests come in from clients on other systems.

As the name implies, file transfer protocol is used to transfer files from one system to another. Transferring files from one computer to another is a two-stage process. You must first establish a connection with, and log in to, the remote computer; then, you must locate and transfer the files you want to move to or from the remote computer.

Establishing an FTP Connection from HP-UX to a PC

NOTE: See also “Establishing an FTP Connection from a PC to HP-UX”.

Before starting the following procedure, make sure FTP is set up for the kind of access you need. The default is to allow only anonymous access. If you want to allow individual user access, you can do this with the Internet Services Manager on your PC.

  1. On your HP-UX system, start the FTP utility by entering the command:

    # /usr/bin/ftp
  2. Open a connection to your PC using ftp’s open command:

    ftp> open vectrapc1.net2.corporate

    If the connection is successful, FTP will let you know that you are connected and display information about the PC’s FTP server:

    Connected to vectrapc1.net2.corporate. 220 vectrapc1 Microsoft FTP Service (Version 2.0).

    If your connection succeeded, proceed to Step 3. If it fails, use Table 5-3.

     

  3. Enter login information

    When you have successfully connected to your PC, another message will follow the Connected to... message:

    Name (vectrapc1.net2.corporate:userx):

    This message is actually a login prompt, and there are several ways to respond to it:

    • Press Return to accept the default response.

      In the above example, there are three parts to the displayed prompt:

      1. The word Name

      2. The network name for your PC (vectrapc1.net2.corporate)

      3. The default user name (userx); this is usually the name of the HP-UX account that you were using when you issued the ftp command in Step 1.

      If you press Return, ftp will attempt to log you in to the PC using the same name as you used to log into HP-UX. You will then be prompted to enter your password. If, after noting the following caution and you feel comfortable doing so, enter the password.

      CAUTION: It is important to note here that any characters you type at your keyboard, including your user name and password will be transmitted over the network to your PC unencrypted.

      Although it is unlikely, especially if your network is strictly an internal network, it is possible that someone could be eavesdropping on your network lines and obtain your login information. If this is a concern to you, HP strongly recommends that you use the anonymous login option described in the following text.

    • Enter a valid account name and password for your PC.

      If the PC account you want to log in to is different from the user name you used to log in to HP-UX, enter the user name for the PC account at the prompt. You will then be prompted to enter the password for the account. If, after noting the preceding caution and you feel comfortable doing so, enter the account’s password.

    • Use FTP’s anonymous login feature.

      Because account names and passwords that you enter from the keyboard during the FTP login process are sent to the remote computer unencrypted (making this sensitive information vulnerable to network eavesdroppers), FTP provides a way to access a remote computer using what is known as an anonymous login. To use this feature, enter the word anonymous at the prompt:

      Name (vectrapc1.net2.corporate:userx): anonymous

      You will then be prompted to enter a password in a special way:

      331 Anonymous access allowed, send identity (e-mail name) as password.

      Instead of entering the actual password for an account, enter your e-mail address as a way of identifying yourself to the FTP server:

      Password: userx@net2.corporate

    After successfully entering the PC account information you will be logged in to the PC and placed in the directory designated as the ftp-root directory in your Windows NT configuration.

    Using the FTP client’s cd command, remote users of the PC can access:

    • The ftp-root directory

    • Any of the subdirectories of the ftp-root directory

    • Selected other directories on the PC that have specifically been made available by the administrator of the PC

      For information about how to make those other directories available, refer to the online documentation associated with the Microsoft Internet Service Manager.

On the HP-UX System: Retrieving a File from the PC

Once you have made a connection and logged in to the PC from your HP-UX system (See “Establishing an FTP Connection from HP-UX to a PC”), you are ready to retrieve a file from the PC.

  1. Locate the file you want to retrieve from your PC. You can use FTP’s cd and ls commands pretty much as you would in an HP-UX shell (sh, ksh, csh, etc.). If it is not in the PC’s ftp-root directory, use FTP’s change directory command (cd) to move to the directory on the PC where the file exists.

  2. Determine whether the file you are trying to transfer is an ASCII (text) file or a binary (non-ASCII) file and set the transfer mode accordingly:

    1. For ASCII files, set the transfer mode using FTP’s ascii command:

      ftp> ascii

      This enables character conversions such as end-of-line carriage return stripping to occur.

    2. For binary files (graphics files, sound files, data base files, etc.), set the transfer mode using FTP’s binary command:

      ftp> binary

      This causes FTP to use an eight-bit-wide (byte) transfer rather than a seven-bit-wide (character) transfer. This is very important as most non-ASCII formats are dependent on that eighth bit of each byte. Your binary files will be corrupted if you transfer them using ASCII mode.

      TIP: If you are unsure of the format of the file you are transferring (ASCII or binary) set the file type to binary. ASCII files will not be corrupted if transferred in binary mode; however, end-of-line character stripping will not occur.
  3. Transfer the file using FTP’s get command.

    Example 5-1 Retrieve an ASCII File with FTP

    To retrieve the ASCII file phone.dat (located in the subdirectory called data, under the ftp-root directory) from the PC:

    ftp>cd data ftp>ascii ftp>get phone.dat

    Example 5-2 Retrieve a Binary File with FTP

    To then retrieve the graphics file net2.jpg from the subdirectory called pics (located under the ftp-root directory):

    ftp>cd ../pics ftp>binary ftp>get net2.jpg

On the HP-UX System: Sending a File to the PC

Once you have made a connection and logged in to the PC from your HP-UX system (See “Establishing an FTP Connection from HP-UX to a PC”), you are ready to transfer a file to the PC.

  1. Locate the file you want to send. You can use FTP’s lcd and ! (execute a local shell command) commands to locate the file on your local system if it is not in the directory that was your current working directory at the time you started ftp. Also, if the file is not in your current directory, you can specify a full (absolute) path name for the file you want to send to your PC.

  2. Determine whether the file you are trying to transfer to your PC is an ASCII text file or a binary (non-ASCII) file and set the transfer mode accordingly:

    1. For ASCII (plain text) files, set the transfer mode using FTP’s ascii command:

      ftp>ascii

      This enables character conversions such as those that handle the differences between how the ends of lines are handled between differing types of operating systems.

    2. For binary files (graphics files, sound files, data base files, etc.), set the transfer mode using FTP’s binary command:

      ftp>binary

      This causes FTP to use an eight-bit-wide byte transfer rather than a seven-bit-wide character transfer. This is very important as most non-ASCII formats are dependent on that eighth bit of each byte. Your binary files will be corrupted if you transfer them using ASCII mode.

      TIP: If you are unsure of the format of the file you are transferring (ASCII or binary), set the file type to binary. ASCII files will not be corrupted if transferred in binary mode; however, end-of-line character handling will not occur.
  3. Transfer the file using FTP’s send command.

    Example 5-3 Send from Different Directory

    To send the ASCII file phone.dat (located in the /var/tmp directory on your HP-UX system) to the PC:

    ftp>lcd /var/tmp ftp>ascii ftp>send phone.dat

    — OR —

    ftp>ascii ftp>send /var/tmp/phone.dat

    Example 5-4 Send from Current Directory

    To send the graphics file roadmap.jpg from the current working directory:

    ftp>binary ftp>send roadmap.jpg

Establishing an FTP Connection from a PC to HP-UX

NOTE: See also “Establishing an FTP Connection from HP-UX to a PC”. If you have a third-party program, use those instructions instead.
  1. On your PC, start the FTP utility:

    1. Click the Start bar in the lower-left corner of your PC’s screen.

    2. Click Programs in the pop-up menu.

    3. Click Accessories in the next pop-up menu.

    4. Click Command Prompt in the final pop-up menu.

    5. Type ftp at the prompt in the window.

  2. Open a connection to your HP-UX system using FTP’s open command:

    ftp> open flserver.net2.corporate

    If the connection is successful, FTP will let you know that you are connected and display information about the FTP server on the HP-UX system:

    Connected to flserver.net2.corporate. 220 flserver FTP Server (Version 1.7.111.1) ready.

    If your connection succeeded, proceed to Step 3.

    If the connection is not successful, FTP will let you know that the connection failed. The displayed error message will vary depending on what is the cause of the failed connection:

    • ftp: connect: Connection refused

      Possible causes of this error message include:

      • Problem:  The internet daemon (inetd) is not running on your HP-UX system.

        Solution:  The real problem is that the ftpd daemon is not running, but it is usually inetd that starts ftpd on an as-needed basis. inetd is usually started up when you boot your computer. If your HP-UX system is in single-user mode you will need to switch it to a run-level of 2 or higher.

      • Problem:  The FTP daemon (ftpd) is not running.

        Solution:  Verify that there is a valid entry in the file /etc/inetd.conf for the ftpd daemon. The entry should look like this:

        ftp stream tcp nowait root /usr/lbin/ftpd ftp -lconf
        Make sure that the entry is not commented out (no # in the first column).

        Make the appropriate repairs and use the command

        /usr/sbin/inetd -c

        to have inetd reread its configuration file.

    • ftp: connect: Connection timed out

      Possible causes of this error message include:

      • Problem:  Your HP-UX system is not currently running.

        Solution:  Make sure your HP-UX system is turned on, and running (the system has been booted).

      • Problem:  Your HP-UX system is not currently reachable on the network.

        Solution:  Make sure that the your HP-UX system is physically connected to the network and that there are no network outages or breaks between your PC and your HP-UX system.

    • ftp: flserver: Unknown host

      Possible causes of this error message include:

      • Problem:  You typed the name of your HP-UX system incorrectly.

        Solution:  Verify that you entered the name of your HP-UX system correctly in the open command. Depending on where in your network structure the system is located with respect to your PC, it might be necessary to fully qualify the HP-UX system name. For example:

        ftp>open flserver

        is probably sufficient if your PC is on your local network segment, but a more fully qualified name, for example:

        ftp>open flserver.net2

        or

        ftp>open flserver.net2.corporate

        will likely be needed to access your HP-UX system if it is located elsewhere in your network (across a router or gateway). If all of the above fail, try using the IP address of the HP-UX system in place of the name. For example:

        ftp>open 15.nn.xx.100

      • Problem:  Your HP-UX system is not formally known to your network.

        Solution:  Make sure that networking services, particularly TCP/IP services have been properly configured on your HP-UX system. The computer must have its own, valid IP address, and you must assign it a valid host name.

  3. Enter login information

    When you have successfully connected to your HP-UX system, another message will follow the Connected to... message:

    Name (flserver.net2.corporate:(none)):

    This message is actually a login prompt, and there are two ways to respond to it:

    • Enter a valid account name and password for your PC.

      You will then be prompted to enter the password for the account. If after noting the following caution you feel comfortable doing so, enter the account’s password.

      CAUTION: It is important to note here that any characters you type at your keyboard, including your user name and password will be transmitted over the network to your PC unencrypted!

      Although it is unlikely, especially if your network is strictly an internal network, it is possible that someone could be eavesdropping on your network lines and obtain your login information. If this is a concern to you, HP strongly recommends that you use the anonymous login option described in the following text.

    • Use FTP’s anonymous login feature

      Because account names and passwords that you enter from the keyboard during the FTP login process are sent to the remote computer unencrypted (making this sensitive information vulnerable to network eavesdroppers), FTP provides a way to access a remote computer using what is known as an anonymous login. To use this feature, enter the word anonymous at the prompt:

      Name (flserver.net2.corporate:userx):anonymous

      You will then be prompted to enter a password in a special way:

      331 Anonymous access allowed, send identity (e-mail name) as password.

      Instead of entering the actual password for an account, enter your e-mail address as a way of identifying yourself to the FTP server:

      Password: glenda@net2.corporate

    After successfully entering the HP-UX account information you will be logged in to your HP-UX system and placed in the directory designated as the ftp-root directory.

    Using the FTP client’s cd command, remote users (logged in anonymously) can access:

    • the ftp-root directory

    • any of the subdirectories of the ftp-root directory

On the PC: Retrieving a File from the HP-UX System

Once you have made a connection and logged in to your HP-UX system from your PC (See “Establishing an FTP Connection from a PC to HP-UX”) you are ready to retrieve a file from the HP-UX system.

  1. Locate the file you want to retrieve from your HP-UX system. You can use FTP’s cd and ls commands pretty much as you would in an HP-UX shell (sh, ksh, csh, etc.). If it is not in the home directory for the HP-UX account that you logged in to, use FTP’s change directory command (cd) to move to the directory on the HP-UX system where the file exists.

  2. Determine whether the file you are trying to transfer is an ASCII file or a binary (non-ASCII) file and set the transfer mode accordingly:

    1. For ASCII (plain text) files, set the transfer mode using FTP’s ascii command:

      ftp>ascii

      This enables character conversions such as end-of-line carriage return stripping to occur.

    2. For binary files (graphics files, sound files, database files, etc.), set the transfer mode using FTP’s binary command:

      ftp>binary

      This causes FTP to use an eight-bit-wide (byte) transfer rather than a seven bit wide (character) transfer. This is very important as most non-ASCII formats are dependent on that eighth bit of each byte!

      CAUTION: Your binary files will be corrupted if you transfer them using ASCII mode.
      TIP: If you are unsure of the format of the file you are transferring (ASCII or binary) set the file type to binary. ASCII files will not be corrupted if transferred in binary mode, however end-of-line character stripping will not occur.
  3. Transfer the file using FTP’s get command.

    Example 5-5 Retrieve an ASCII File with FTP

    To retrieve the ASCII file phone.dat (located in the subdirectory called data, under the home directory for your account) from the HP-UX system:

    ftp>cd data ftp>ascii ftp>get phone.dat

    Example 5-6 Retrieve a Binary File with FTP

    To then retrieve the graphics file net2.jpg (from the subdirectory called pics located under the home directory):

    ftp>cd ../pics ftp>binary ftp>get net2.jpg

On the PC: Sending a File to the HP-UX System

Once you have made a connection and logged in to your HP-UX system (See “Establishing an FTP Connection from a PC to HP-UX”), you are ready to transfer a file to the your HP-UX system.

  1. On your PC, locate the file you want to send. You can use FTP’s lcd and ! commands to locate the file on your local system if it is not in the directory that was your current working directory at the time you started ftp. If the file is not in your current directory, you can specify a full (absolute) path name for the file you want to send to your HP-UX system, or use FTP’s lcd command to move to the directory containing the file.

  2. Determine whether the file you are trying to transfer to your HP-UX system is an ASCII file or a binary (non-ASCII) file and set the transfer mode accordingly:

    1. For ASCII (plain text) files, set the transfer mode using FTP’s ascii command:

      ftp>ascii

      This enables character conversions such as those that handle the differences between how the ends of lines are handled between differing types of operating systems.

    2. For binary files (graphics files, sound files, database files, etc.), set the transfer mode using FTP’s binary command:

      ftp>binary

      This causes FTP to use an eight-bit wide (byte) transfer rather than a seven bit wide (character) transfer. This is very important as most non-ASCII formats are dependent on that eighth bit of each byte! Your binary files will be corrupted if you transfer them using ASCII mode.

      TIP: If you are unsure of the format of the file you are transferring (ASCII or binary) set the file type to binary. ASCII files will not be corrupted if transferred in binary mode, however end-of-line character handling will not occur.
  3. Transfer the file using FTP’s send command.

    Example 5-7 Send an ASCII File with FTP

    To send the ASCII file phone.dat (located in the C:\office_stuff directory on your PC) to your HP-UX system:

    ftp>lcd C:\office_stuff ftp>ascii ftp>send phone.dat

    — OR —

    ftp>ascii ftp>send C:\office_stuff\phone.dat

    Example 5-8 Send a Binary File with FTP

    To send the graphics file roadmap.jpg from the current working directory:

    ftp>binary ftp>send roadmap.jpg
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.