[Next] [Previous] [Up] [Top] [Contents] [Index]
Chapter 13: Connecting to Remote Systems
ftp (File Transfer Protocol) can be used to transfer files to and from a remote system on which you have an account, and to manipulate the remote file system. The command format is:
% ftp [-n] [-i] [host]
If you specify host on the command line, you will be prompted for your (remote) username and password, and login will proceed. The option -n
inhibits autologging on those systems on which it is enabled. The option -i
eliminates prompting by the system, which can be tiresome when you're transferring many files.
[Missing image]Some commands available in ftp are described here; for a complete list, see the man pages for ftp.
user
username password Identification for the remote system. If auto-log is enabled, you will be prompted automatically for the username and password. If you don't specify the password, it will prompt you.
bin
or binary
Set transfer mode to binary image transfer.
ascii
Set transfer mode to ASCII (for text files).
put
local_file [remote_file] Transfer a local file to the remote system. If the remote filename is not specified, the local filename is used.
mput
local_files [remote_files] Similar to put
, but you can use standard wildcard characters to transfer a series of files at a time.
get
remote_file [local_file] Transfer a remote file to the local system. If the local file name is not specified, it is given the name on the remote machine.
mget
remote_files [local_files] Similar to get
, but you can use standard wildcard characters to transfer a series of files at a time.
help
[command] Display information about the meaning of command. If no command is specified, ftp displays a list of the commands.
quit
Terminate the ftp session with the remote server and exit ftp.
open
host Establish connection with remote host. Needed if host was not specified on command line.
close
Close connection with remote host and return to ftp prompt. Doesn't exit ftp.
dir
[remote_directory] [local_file] Print listing of the directory contents of the remote directory and optionally put the output in local_file.
cd
remote_directory Change working directory on the remote machine to remote_directory.
lcd
[directory] Change working directory on the local machine. If no directory is specified, your home directory is used.
delete
remote_file Delete the file remote_file on the remote system.
! shell_command
Run a shell command without exiting ftp.
The following is an example ftp session where first one ASCII file, then a few binary files, are transferred from one UNIX machine to another. The username is unnecessary if the assumed one is correct. The password, as usual, is not displayed.
|
[Missing image]Note that the CERN utility zftp (z for Zebra) is available for transferring FZ and RZ files (ntuple files) between systems[69]. To use zftp, it must be installed on the server system, and you need to set up CERN library during the session (setup cern
).
Another way to transfer files is with the rcp utility (stands for remote copy). You can use this command if both local and remote hosts support rcp protocol. The basic format is:
% rcp [options] file1 file2
where file1 and file2 are the source and destination filenames, respectively; or
% rcp [options] file1 file2 ... directory
where the files listed are to be copied to the directory. On a UNIX system the format of a remote directory or filename is hostname:path
, and the MultiNet implementation is consistent with VMS usage, namely hostname::path
(note the double colon). If only filenames are given, they are interpreted relative to your home directory. Both the source and the destination may be on nodes other than the current machine.
-p
Give each copy the same modification times, access times, and modes as the original file.
-r
Copy each subtree rooted at file1, file2, etc. (for those that are directories); in this case the destination (last argument) must be a directory.
rcp does not prompt for passwords. Your current local user name must exist on the remote host and allow remote command execution by rsh. rsh is a utility that connects to a remote host and either executes a specified command or logs you on via rlogin (see section 13.3).
[Missing image]More information is available in the rsh and rcp man pages.
When you are using rcp between VMS and UNIX, you must protect special characters from local interpretation by enclosing them in quotes. An example command to copy a file $HOME/prog1.c
from UNIX to the VMS node FNALV is:
% rcp prog1.c fnalv:"[.c]prog1.c"
Here is an example showing how to copy a file from remote UNIX node FNSG01 to the home directory on the VMS node ($
represents the VMS prompt):
$ rcp fnsg01::"/usr/products/bufio/v1_00/src" bufio.src
[Missing image]If you are using the C shell family, rcp will not work if your .cshrc
or .login
on UNIX, or your LOGIN.COM
file on a remote VMS host, executes interactive or output-generating commands. You should check for non-interactive access, and exit before such commands are executed, as is done for a UNIX system in the FUE default .cshrc
file. The lines in .cshrc
that check this are the following:
|
On a VMS system, check for OTHER
(TCP/IP is not NETWORK
):
$ IF (F$MODE () .EQS. "OTHER") THEN $ EXIT
Although you can specify a username and password with rcp (see the local man pages or HELP
), you can also have a kind of "proxy login" by creating a special file (named .rhosts
) on the remote machine containing the names of the systems and users on those system that should be allowed access.
To use many of the file transfer utilities, you need to set up what is known as a .rhosts
file on the remote machine. This file must include a list of the names of the systems to be allowed remote access without login, and the usernames, where each system-username combination is separated by a space. If the username is left off, it is assumed to be the same as on the current system. If there are problems with name servers, you can be most assured that your address will be understood if you specify three lines for each connection requested:
2) one with the Internet number[70], and
3) one with the local name.
An example .rhosts
file showing a single connection in the three specified formats:
|
When writing a .rhosts
file on a UNIX host to allow access via remote commands (known as r-commands[71]
) from a VMS cluster, you must include an entry for each cluster member and username from which you might access the UNIX host.
The following command line is an example of the command to copy a FINGER.PLN
file from an account on FNALA to the file .plan
in the same person's account on the UNIX node FNSG01. In order for this example to work, there must be a file named .rhosts
on FNSG01 containing a line fnala.fnal.gov,
and the username must be the same in both places.
$ RCP FINGER.PLN FNSG01::.PLAN
where $
is the VMS prompt.
nslookup
node to get the number. On VMS, you must enter MULTINET NSLOOKUP
hostname.
.rhosts
for authentication. They are variants of UNIX commands without the "r", and include for example rsh
(r
emote sh
) and rlogin
(r
emote login
).