![]()
|
ssh,
slogin,
scp, and
sshd.
ssh-agent,
ssh-add,
ssh-askpass.
rlogin,
rsh, and
rcp.
ftp or
telnet or
rlogin).
slogin hostname
[-l username] [-v] [-x] [other options]
-v verbose mode
-x don't tunnel X connection
-l username different username on
remote host
ssh hostname
[-l username] [-v]
command [args]
One-off command; falls back to slogin
if no command given. Most options work with
ssh as with
slogin. Command can be quoted (' or ")
scp file.ext
[username@]hostname:[path/file]
Several points to note:
ssh-agent:
typically run from .xinitrc; holds
authentication key(s).
(those are backticks). Environment variables (e.g.eval `ssh-agent`or
ssh-agent my-window-manager
SSH_AGENT_PID) inherited by
child processes. Can be run from an xterm (not as good).
ssh-add: adds
your key to the agent. If you have a passphrase (see next slide) it
asks for it and caches it.
ssh-askpass:
GUI way of prompting for your passphrase if you have one, e.g.:
ssh-askpass | ssh-add
-p
Grabs the X focus (as does the xterm ctrl-left-mouse menu
item "Secure Keyboard") to make it harder for others to monitor
keystrokes:
cd
ssh-keygen
~/.ssh/) by pressing
<return>
<return>
when asked for it (see next slide
if you want a non-blank passphrase).
cd ~/.ssh/
cp identity.pub
authorized_keys
chmod 0600
authorized_keys
This gives password-less access to any local machines that share your login area (via NFS, presumably). This can be good and bad.
slogin
to the remote site; it'll want your password.
identity.pub file
from the local host, and append it to the authorized_keys
file you just created on the remote host. This allows you a
password-less login from local to remote.
identity.pub from
the remote host and append it to the authorized_keys
file on the local host.
ssh-keygen
-p will add or change a passphrase.
ssh-agent and
ssh-add to cache your
identity; you thus only need to authenticate once on login,
and all your remote connections will query the agent (not you)
for your identity.
scp. Solution is to use
special purpose keys (see below).
DISPLAY variable is
automatically set to, e.g., remotehost:10
xhost or
xauth; it just works.
-C to command lines, or use
~/.ssh/config
to enable for some or all hosts. For text (including PS) transfers,
can vastly improve performance. Works for simple X apps too (emacs)
but doesn't do much for graphic-intensive X apps.
command="/home/mystuff/progname",no-port-forwarding,
no-X11-forwarding,no-agent-forwarding,no-pty 1024 37 343452435...
(for example; but no line breaks!) in authorized_keys on that new key,
this restricts what ssh using
the equivalent private key can do. You can use environment
variables:
SSH_ORIGINAL_COMMAND and
SSH_CLIENT (remote IP)
within the program or script. Use
stdout from your program/script to
send output to the other end, or read from
stdin if the remote end sends to its
stdout.
This has been used to facilitate many automatic jobs within NRAO
that used to use rcp and relied on
.rhosts files. Here is a sample perl script that serves up only
certain files.
-L and
-R options in
the manual pages for ssh.
ssh is being widely deployed in many
places (especially academia) in response to a rash of break-ins and
password sniffing incidents.
rsh
and rcp can still be done with
dedicated keys and appropriate programs.