Anda di halaman 1dari 5

Remote Logins and File Transfers

This document explains how to log in to the campus/ Department Unix computers from a home PC that is
connected to the internet and is running windows or Unix (Linux). It also explains how to transfer files.
The Unix method can also be used to go to another Unix machine from a Campus/ Department computer
running Unix.

On general principles, any remote login sessions should be encrypted. That way an eavesdropper will not
be able to see any passwords you type. The campus/ department does not support unencrypted logins.

Windows users will want software that supports at least a terminal session and file transfers. Such
software is available free of charge. You can also get software that provides full X-terminal functionality.
Usually, you have to buy a license, but X-win32 is available free of charge to University of Utah students
and faculty.

Mac users with the X11 package installed can get a full terminal session using ssh and file transfers with
scp as described below.

Windows: PuTTY

PuTTY is a free terminal emulation program for Windows. It supports ssh encryption. It was developed by
Simon Tatham and maintained by him and collaborators in Cambridge, England, who have graciously
offered it to the public free of charge. The current download site is on, but if you don't find it there, search
Google for PuTTY. The software you want is called putty.exe. Be sure to select the version appropriate
for your computer.

To use PuTTY to connect to the Campus/ Department computers, you need to set it so it uses the secure
shell client ssh protocol 2, rather than telnet to make the connection, and you need to give it the domain
name of a campus/ machine. The generic domain name is campus/.utah.edu. From there you can access
all of your Campus/ files.

Once you have made a successful connection, you must log in with your Campus/ Department username
and password. You then have the equivalent of a dumb terminal window. You may open as many PuTTY
sessions as you need.

PuTTY does not give you the full capabilities of our computer lab X-window manager. For example, the
mouse does not interact with the remote machine-it interacts only with PuTTY. You will not be able to
display gnuplot graphs on your PC. So, while you can run emacs inside the PuTTY window, emacs does
not see mouse functions. This means you have to use the keyboard and the emacs keyboard shortcuts. It
does not take long to learn them. If you need any of the emacs pull-down menu-bar options, use the
<F10> key. With a little practice, you will find it quite easy to operate in this environment.

To get full X-windows functionality requires a full X-terminal emulator in addition to PuTTY. See X-Win32
below.

Windows: WinSCP

WinSCP by Martin Prykryl of the Czech Republic is a popular user-friendly client for transfering files to
and from a home PC and the Campus/ Department computers. It is currently available from SourceForge,
but search Google for WinSCP if it is not there.

To open a WinSCP session you need to tell it your username and the domain name of a campus/
computer. The generic name is campus/.utah.edu.
The program gives a convenient side-by-side display of the files and directories (folders) of your home
computer and those of your Campus/ Department account. You can copy files and whole directories from
one window to the next by double-clicking the source file name or using drag and drop. Note that a copy
operation will replace any file of the same name without warning. So take care that you remember which
side is for your home PC and which side is for the Campus/ Department computer. If you move a file the
wrong way, you may end up replacing a new version with an old version. Also note that WinSCP uses a
group selection feature to allow copying of whole sets of files and/or directories. So if you are not paying
attention to this feature, you may end up copying more than you intended.

X-Win32

This utility allows you to open windows from a campus/ department machine, so you should be able to run
gnuplot and other utilities requiring a windows display. It requires a little sophistication to use it. It is
currently available free of charge to students and faculty at the University of Utah. See the Office of
Software Licensing.

To obtain this utility, on the OSL site go through the steps of shopping and ``purchasing'' the software.
Don't worry, your price is zero. Select ``X'' and X-Win32. Choose the single-user student license. When
you check out, log in with your uNID and password. Download the version with ssh. In August 2009 that
version (9.4) is in the file x-win94-1069_ssh_f.exe. PLEASE MAKE A NOTE of the license key that is
displayed. You'll need it later when you first run the software.

When you start up X-Win32 for the first time, you'll need to configure it for one of the campus/ machines.
The generic campus/.utah.edu will do. So start X-Config and click the ``Wizard'' button. Give a name to
the session (e.g. UUPhysAstro) and select type ``ssh''. Enter the host name of the campus/ machine, e.g.
campus/.utah.edu. Enter your username and password. For additional security, you can omit the
password and supply instead each time you log in. Choose SunOS for the operating system type. The
X11 command to run on startup is /usr/openwin/bin/xterm -ls for SUN Solaris. (Note that -ls is a ``dash-ell-
ess''.) The Wizard should already know this command. When you first run X-Win32, you will also be
asked for your license key. You should select the ``node-locked (VN)'' type and enter the license key in
the ``VN'' box.

Unix: telnet, rsh, rlogin, ssh, slogin

The telnet utility was the first standard Unix method for reaching a remote machine. Utilities with similar
functionality are rsh and rlogin. All of these utilities require that you enter a username and password.
However, they do not provide a secure connection. That is to say, anything you type, including your
password, is passed without encryption to the remote host, so if it is intercepted, it could be used by
someone else to access your account. For this reason many institutions, including the Campus/
Department, have discontinued use of these utilities in favor of ssh and slogin.

The ssh session to a remote machine named campus/.utah.edu is started with the command

ssh campus/.utah.edu -l <username>


You are then prompted for your password. You should get an xterm session. If your local ssh client is
compatible with the Campus/ ssh daemon, you should be able to launch X-window processes from
campus/.utah.edu and display them on your local Unix machine running X-windows. That process is
called automatic X-fowarding. You may also be able to force X-fowarding using the -X option as in
ssh campus/.utah.edu -Xl <username>

If automatic X-forwarding doesn't work, you may need to set permissions to launch X sessions. Here is
how to do that. Suppose your local machine is called myhost.mydomain.com. You first need to tell your
local window manager that campus/.utah.edu has permission to create windows and you have to tell
campus/.utah.edu where to put them. In this case, start your session with
xhost campus/.utah.edu
ssh campus/.utah.edu
and after you log in, type the following command:
setenv DISPLAY myhost.mydomain.com:0.0
Then if you type emacs, for example, the emacs window should appear on your local machine.

Security note: If you don't use automatic X-forwarding, any X session you launch is not encrypted. The
security concern here is that you launch an xterm window and then type a password in it.

The slogin command works the same way as the ssh command and uses the same syntax. See the man
pages for more detail. The main difference among them is that the ssh command can be used to run a
single command on the remote machine and then quit.

To end your session, type exit or logout.

rcp, scp

The rcp and scp commands are used to transfer files to and from a remote machine. The ftp command
described below does this and more.

To illustrate the rcp utility, suppose you have a file called exercise01 in your subdirectory a01 (in your
home directory) under your Campus/ account with username zeke and your want to copy it into the
current directory of your local machine. You do this with the command

rcp "zeke@campus/.utah.edu:a01/exercise01" .
Be sure to notice the colon and dot. The dot specifies the current directory. The colon separates the name
of the machine from the directory and file. Since you are specifying your account, all relative paths start
from your home directory. You will be prompted for your password before the file is transferred. The
quotes for the specification of the remote file name aren't really necessary here, but if you use wild cards,
e.g. exercise?? they are.

To reverse this copy, sending a file named exercise01 on the local machine in the current directory to
your Campus/ account in the subdirectory a01 you use the command

rcp exercise01 zeke@campus/.utah.edu:a01


It should be evident that the rcp command behaves very much like the plain Unix cp command.

The scp command has the same syntax and behavior, except that the session is encrypted and a record
of encryption keys is kept for each host.

ftp

The ftp utility is more versatile, since it allows making a directory listing and provides for some
manipulating of files and directories on the remote machine as well as carrying out file transfers. Usually
you must have an account on the remote machine, but as a matter of public service, some system
administrators arrange for "anonymous" logins for the purpose of transferring certain free software and
files. The "anonymous" logins are restricted so only specific files are accessible.

For example, here is a session extracting a file from the University of Utah Computer Science department
network via "anonymous ftp." We start at the Unix command prompt by typing ftp hostname. You are then
prompted for a name and password. If you had an account on that machine, you would type your
username and password. For an anonymous login, the username is anonymous and the ``password'' is
typically your e-mail address, although in this case your are just asked for your name.

ftp cs.utah.edu
Connected to cs.utah.edu.
220 cs.utah.edu FTP server (Version 5.251 Thu Jan 27 11:55:32 MST 1994) ready.
Name (cs.utah.edu:p373): anonymous
331 Guest login ok, type your name as password.
Password: yourname@mail.campus/.utah.edu
230 Guest login ok, access restrictions apply.

At this point if you had an account, you would be connected to your home directory. For anonymous ftp,
you are connected to a directory with files that are made available by the system manager of that host. To
see what is available, use the ls or dir command. The response depends on the host operating system.
The latter command usually gives more information.

ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for 'file list'.
pub
bin
etc
netinfo
dist
graphics
techreports
grad_info
registrar
226 Transfer complete.
These all happen to be directories. Let's look at the pub directory. We can switch to that directory with the
Unix command cd pub.
ftp> cd pub
250 CWD command successful.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for '/bin/ls'.
.......
-rw-r--r-- 1 hop null 13620 Apr 9 1992 usart-paper-tr.ps.Z
-rw-r--r-- 1 hop null 163417 Apr 9 1992 usart-paper.ps.Z
-rw-r--r-- 1 gershon null 41289 Sep 23 1992 uuthesis.shar.Z
drwxr-xr-x 2 willrich null 512 Sep 28 1993 willrich
drwxr-xr-x 6 tch null 512 Apr 24 1993 zoo-display
-rw-r--r-- 1 jamie null 77621 Mar 3 1993 zoom.tar.Z
226 Transfer complete.

We omitted most of the output. Notice the difference in format between the result of the ls command and
dir command. Let's see how to obtain the file uuthesis.shar.Z. This file happens to contain LaTeX style
files and related files for one of the acceptable University of Utah thesis formats.

Before transferring the file we must decide whether ASCII or binary format is best. In this case the file
name ends with .Z. Such files are conventionally Unix compressed format files, so contain non-ASCII
characters. The default ftp mode is ASCII, so in this case we must switch to binary with the bi command.
Then we use get to get the file:

ftp> bi
200 Type set to I.
ftp> get uuthesis.shar.Z
200 PORT command successful.
150 Opening BINARY mode data connection for 'uuthesis.shar.Z' (41289 bytes).
226 Transfer complete.
41289 bytes received in 1.724 seconds (23.39 Kbytes/s)

With this procedure the file is received into the directory from which we invoked ftp in the first place with
the same name as on the remote machine. If we want a different name, we could add a second argument
as in

ftp> get uuthesis.shar.Z newname.Z

Now that we are finished, we quit using

ftp> quit
221 Goodbye.

To see a list of other ftp commands, type help or ? at the ftp> prompt. To learn more about ftp, try man
ftp.

What do you do with the file uuthesis.shar.Z? First you should put it in a directory by itself. It is a
compressed Unix file, so first uncompress it with the command

uncompress uuthesis.shar.Z

The resulting file is called uuthesis.shar. The extension .shar is commonly used for a ``Shell archive'' file.
Such files are usually a collection of several files in a self-unpacking format. A glance at the top of the
file...

% head uuthesis.shar
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 09/24/1992 00:48 UTC by gershon@lotus
# Source directory /tmp_mnt/n/pixel/a2/pub/gershon/thesis/thesis
#
# existing files will NOT be overwritten unless -c is specified
#
tells what to do. Just type
sh uuthesis.shar
The resulting files look like this
% ls
thesis.tex uut11.sty uuthesis.shar
uuguide.tex uut12.sty uuthesis.sty
You may now safely delete the original packed file uuthesis.shar.

Another common procedure is to pack the files using the Unix ``tape archive'' tar format. Conventionally
such files are named with a .tar extension. To unpack them, use

tar -xf filename.tar

Anda mungkin juga menyukai