<?Pub UDT _bookmark _target?><?Pub CX solbook(?><chapter id="sshuser-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag atict:user
user="sharonr" fullname="Sharon Veach"?><title>Using Solaris Secure Shell (Tasks)</title><highlights><itemizedlist><para>Solaris Secure Shell enables a user to securely access a remote host over an unsecured
network. The shell provides commands for remote login and remote file transfer.
The following is a list of topics in this chapter.</para><listitem><para><olink targetptr="sshuser-2" remap="internal">Solaris Secure Shell (Overview)</olink></para>
</listitem><listitem><para><olink targetptr="sshuser-6" remap="internal">Solaris Secure Shell Enhancements
in the Solaris 10 Release</olink></para>
</listitem><listitem><para><olink targetptr="sshuser-24" remap="internal">Configuring Solaris Secure Shell
(Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="sshuser-14" remap="internal">Using Solaris Secure Shell (Task
Map)</olink></para>
</listitem>
</itemizedlist><para>For reference information, see <olink targetptr="sshref-1" remap="internal">Chapter&nbsp;20,
Solaris Secure Shell (Reference)</olink>.</para>
</highlights><sect1 id="sshuser-2"><title>Solaris Secure Shell (Overview)</title><indexterm><primary>encrypting</primary><secondary>network traffic between hosts</secondary>
</indexterm><para><indexterm><primary>access</primary><secondary>security</secondary><tertiary>remote systems</tertiary></indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>description</secondary></indexterm>In Solaris Secure Shell,
authentication is provided by the use of passwords, public keys, or both.
All network traffic is encrypted. Thus, Solaris Secure Shell prevents a would-be intruder
from being able to read an intercepted communication. Solaris Secure Shell also prevents
an adversary from spoofing the system.</para><para>Solaris Secure Shell can also be used as an on-demand <olink targetptr="glossary-78" remap="internal">virtual
private network (VPN)</olink>. A VPN can forward X Window system traffic or
can connect individual port numbers between the local machines and remote
machines over an encrypted network link.</para><itemizedlist><para>With Solaris Secure Shell, you can perform these actions:</para><listitem><para>Log in to another host securely over an unsecured network.</para>
</listitem><listitem><para>Copy files securely between the two hosts.</para>
</listitem><listitem><para>Run commands securely on the remote host.</para>
</listitem>
</itemizedlist><para><indexterm><primary>Solaris Secure Shell</primary><secondary>protocol versions</secondary></indexterm><indexterm><primary>v1 protocol</primary><secondary>Solaris Secure Shell</secondary></indexterm><indexterm><primary>v2 protocol</primary><secondary>Solaris Secure Shell</secondary></indexterm>Solaris Secure Shell supports
two versions of the Secure Shell protocol. Version 1 is the original version
of the protocol. Version 2 is more secure, and it amends some of the basic
security design flaws of version 1. Version 1 is provided only to assist users
who are migrating to version 2. Users are strongly discouraged from using
version 1.</para><note><para>Hereafter in this text, v1 is used to represent version 1, and
v2 is used to represent version 2.</para>
</note><sect2 id="sshuser-3"><title>Solaris Secure Shell Authentication</title><indexterm><primary>Solaris Secure Shell</primary><secondary>authentication</secondary><tertiary>requirements for</tertiary>
</indexterm><indexterm><primary>authentication</primary><secondary>Solaris Secure Shell</secondary><tertiary>methods</tertiary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>authentication methods</secondary>
</indexterm><indexterm><primary>authentication methods</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><para>Solaris Secure Shell provides public key and password methods for authenticating the
connection to the remote host. Public key authentication is a stronger authentication
mechanism than password authentication, because the private key never travels
over the network.</para><para>The authentication methods are tried in the following order. When the
configuration does not satisfy an authentication method, the next method is
tried.</para><itemizedlist><listitem><para><indexterm><primary>public key authentication</primary><secondary>Solaris Secure Shell</secondary></indexterm><indexterm><primary>GSS-API</primary><secondary>authentication in Solaris Secure Shell</secondary></indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>public key authentication</secondary></indexterm><emphasis role="strong">GSS-API &ndash;</emphasis> Uses credentials for GSS-API mechanisms such as <literal>mech_krb5</literal> 
(Kerberos V) and <literal>mech_dh</literal> (AUTH_DH) to authenticate clients
and servers. For more information on GSS-API, see <olink targetdoc="gssapipg" targetptr="overview-61" remap="external"><citetitle remap="section">Introduction to GSS-API</citetitle> in <citetitle remap="book">Solaris Security for Developers Guide</citetitle></olink>.</para>
</listitem><listitem><para><indexterm><primary>host-based authentication</primary><secondary>description</secondary></indexterm><emphasis role="strong">Host-based
authentication &ndash;</emphasis> Uses host keys and rhosts files. Uses the
client's RSA and DSA public/private host keys to authenticate the client.
Uses the rhosts files to authorize clients to users.</para>
</listitem><listitem><para><emphasis role="strong">Public key authentication &ndash;</emphasis> Authenticates
users with their RSA and DSA public/private keys.</para>
</listitem><listitem><para><indexterm><primary>passwords</primary><secondary>authentication in Solaris Secure Shell</secondary></indexterm><indexterm><primary>password authentication</primary><secondary>Solaris Secure Shell</secondary></indexterm><emphasis role="strong">Password authentication &ndash;</emphasis> Uses PAM to authenticate
users.  Keyboard authentication method in v2 allows for arbitrary prompting
by PAM. For more information, see the <literal>SECURITY</literal> section
in the <olink targetdoc="group-refman" targetptr="sshd-1m" remap="external"><citerefentry><refentrytitle>sshd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</listitem>
</itemizedlist><para><indexterm><primary>hosts</primary><secondary>Solaris Secure Shell hosts</secondary></indexterm>The following table shows the requirements for authenticating
a user who is trying to log into a remote host. The user is on the local host,
the client. The remote host, the server, is running the <command>sshd</command> daemon.
The table shows the Solaris Secure Shell authentication methods, the compatible protocol
versions, and the host requirements.</para><table frame="topbot" pgwide="1" id="sshuser-tbl-1"><title>Authentication
Methods for Solaris Secure Shell</title><tgroup cols="3" colsep="0" rowsep="0"><?PubTbl tgroup dispwid="5.50in"?><colspec colname="colspec0" colwidth="17.94*"/><colspec colname="colspec1" colwidth="34.25*"/><colspec colname="colspec2" colwidth="35.21*"/><thead><row rowsep="1"><entry><para>Authentication Method (Protocol Version)</para>
</entry><entry><para>Local Host (Client) Requirements</para>
</entry><entry><para>Remote Host (Server) Requirements</para>
</entry>
</row>
</thead><tbody><row valign="top"><entry rowsep="1"><para><indexterm><primary>authentication methods</primary><secondary>GSS-API credentials in Solaris Secure Shell</secondary></indexterm>GSS-API (v2)</para>
</entry><entry rowsep="1"><para>Initiator credentials for the GSS mechanism.</para>
</entry><entry rowsep="1"><para>Acceptor credentials for the GSS mechanism. For more information, see <olink targetptr="sshref-15" remap="internal">Acquiring GSS Credentials in Solaris Secure Shell</olink>.</para>
</entry>
</row><row valign="top"><entry rowsep="1"><para><indexterm><primary>authentication methods</primary><secondary>host-based in Solaris Secure Shell</secondary></indexterm>Host-based (v2)</para>
</entry><entry rowsep="1"><para>User account</para><para>Local host private key in <filename>/etc/ssh/ssh_host_rsa_key</filename> or <filename>/etc/ssh/ssh_host_dsa_key</filename></para><para><literal>HostbasedAuthentication yes</literal> in <filename>/etc/ssh/ssh_config</filename></para>
</entry><entry rowsep="1"><para>User account</para><para>Local host public key in <filename>/etc/ssh/known_hosts</filename> or <filename>~/.ssh/known_hosts</filename></para><para><literal>HostbasedAuthentication yes</literal> in <filename>/etc/ssh/sshd_config</filename></para><para><literal>IgnoreRhosts no</literal> in <filename>/etc/ssh/sshd_config</filename></para><para>Local host entry in <filename>/etc/ssh/shosts.equiv</filename>, <filename>/etc/hosts.equiv</filename>, <filename>~/.rhosts</filename>,  or <filename>~/.shosts</filename></para>
</entry>
</row><row><?PubTbl row rht="2.38in"?><entry rowsep="1"><para><indexterm><primary>authentication methods</primary><secondary>public keys in Solaris Secure Shell</secondary></indexterm>RSA or DSA public key
(v2)</para>
</entry><entry rowsep="1"><para>User account</para><para>Private key in <filename>~/.ssh/id_rsa</filename> or <filename>~/.ssh/id_dsa</filename></para><para>User's public key in <filename>~/.ssh/id_rsa.pub</filename> or <filename>~/.ssh/id_dsa.pub</filename></para>
</entry><entry rowsep="1"><para>User account</para><para>User's public key in <filename>~/.ssh/authorized_keys</filename></para>
</entry>
</row><row><entry rowsep="1"><para>RSA public key (v1)</para>
</entry><entry rowsep="1"><para>User account</para><para>Private key in <filename>~/.ssh/identity</filename></para><para>User's public key in <filename>~/.ssh/identity.pub</filename></para>
</entry><entry rowsep="1"><para>User account</para><para>User's public key in <filename>~/.ssh/authorized_keys</filename></para>
</entry>
</row><row><entry rowsep="1"><para><indexterm><primary>authentication methods</primary><secondary>keyboard-interactive in Solaris Secure Shell</secondary></indexterm>Keyboard-interactive (v2)</para>
</entry><entry rowsep="1"><para>User account</para>
</entry><entry rowsep="1"><para>User account</para><para>Supports PAM, including arbitrary prompting and password changing when
password aging is triggered.</para>
</entry>
</row><row><entry rowsep="1"><para><indexterm><primary>authentication methods</primary><secondary>password in Solaris Secure Shell</secondary></indexterm>Password-based (v1 or v2)</para>
</entry><entry rowsep="1"><para>User account</para>
</entry><entry rowsep="1"><para>User account</para><para>Supports PAM.</para>
</entry>
</row><row><entry><para><filename>.rhosts</filename> only (v1)</para>
</entry><entry><para>User account</para>
</entry><entry><para>User account</para><para><literal>IgnoreRhosts no</literal> in <filename>/etc/ssh/sshd_config</filename></para><para>Local host entry in <filename>/etc/ssh/shosts.equiv</filename>, <filename>/etc/hosts.equiv</filename>, <filename>~/.shosts</filename>, or <filename>~/.rhosts</filename></para>
</entry>
</row><row><entry rowsep="1"><para><filename>.rhosts</filename> with RSA (v1) on server only</para>
</entry><entry rowsep="1"><para>User account</para><para>Local host public key in <filename>/etc/ssh/ssh_host_rsa1_key</filename></para>
</entry><entry rowsep="1"><para>User account</para><para>Local host public key in <filename>/etc/ssh/ssh_known_hosts</filename> or <filename>~/.ssh/known_hosts</filename></para><para><literal>IgnoreRhosts no</literal> in <filename>/etc/ssh/sshd_config</filename></para><para>Local host entry in <filename>/etc/ssh/shosts.equiv</filename>, <filename>/etc/hosts.equiv</filename>, <filename>~/.shosts</filename>, or <filename>~/.rhosts</filename></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="sshuser-4"><title>Solaris Secure Shell in the Enterprise</title><para>For a comprehensive discussion of Secure Shell on a Solaris system,
see <citetitle>Secure Shell in the Enterprise</citetitle>, by Jason Reid,
ISBN 0-13-142900-0, June 2003. The book is part of the Sun BluePrints Series,
which is published by Sun Microsystems Press.</para><itemizedlist><para>For online information, navigate to Sun's BigAdmin System Administration
Portal web site, <ulink url="http://www.sun.com/bigadmin" type="url">http://www.sun.com/bigadmin</ulink>. Click Docs, then Sun BluePrints under Misc./Comprehensive. Click
Sun BluePrints OnLine, then Archives by Subject, then Security. The archives
include the following articles:</para><listitem><para><citetitle>Role Based Access Control and Secure Shell &ndash;
A Closer Look At Two Solaris Operating Environment Security Features</citetitle></para>
</listitem><listitem><para><citetitle>Integrating the Secure Shell Software</citetitle></para>
</listitem><listitem><para><citetitle>Configuring the Secure Shell Software</citetitle></para>
</listitem>
</itemizedlist>
</sect2>
</sect1><sect1 id="sshuser-6"><title>Solaris Secure Shell Enhancements in the Solaris 10 Release</title><indexterm><primary>new features</primary><secondary>Solaris Secure Shell enhancements</secondary>
</indexterm><indexterm><primary>OpenSSH</primary><see>Solaris Secure Shell</see>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>changes in current release</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>basis from OpenSSH</secondary>
</indexterm><itemizedlist><para>Since the Solaris 9 release, the following changes have been introduced to Solaris Secure Shell:</para><listitem><para>Solaris Secure Shell is based on OpenSSH 3.5p1. The Solaris implementation
also includes features and bug fixes from versions up to OpenSSH 3.8p1.</para>
</listitem><listitem><para>The default value of <literal>X11Forwarding</literal> is <literal>yes</literal> in the <filename>/etc/ssh/sshd_config</filename> file.</para>
</listitem><listitem><itemizedlist><para>The following keywords have been introduced:</para><listitem><para><literal>GSSAPIAuthentication</literal></para>
</listitem><listitem><para><literal>GSSAPIKeyExchange</literal></para>
</listitem><listitem><para><literal>GSSAPIDelegateCredentials</literal></para>
</listitem><listitem><para><literal>GSSAPIStoreDelegatedCredentials</literal></para>
</listitem><listitem><para><literal>KbdInteractiveAuthentication</literal></para>
</listitem>
</itemizedlist><para>The <literal>GSSAPI</literal> keywords enable Solaris Secure Shell to use GSS credentials
for authentication. The <literal>KbdInteractiveAuthentication</literal> keyword
supports arbitrary prompting and password changing in PAM. For a complete
list of keywords and their default values, see <olink targetptr="sshref-10" remap="internal">Keywords
in Solaris Secure Shell</olink>.</para>
</listitem><listitem><para>The ARCFOUR and AES128-CTR ciphers are now available. ARCFOUR
is also known as RC4. The AES cipher is AES in counter mode.</para>
</listitem><listitem><para>The <command>sshd</command> daemon uses the variables in <filename>/etc/default/login</filename> and the <command>login</command> command. The <filename>/etc/default/login</filename> variables can be overridden by values in the <filename>sshd_config</filename> file. For more information, see <olink targetptr="sshref-17" remap="internal">Solaris Secure Shell and Login Environment Variables</olink> and
the <olink targetdoc="group-refman" targetptr="sshd-config-4" remap="external"><citerefentry><refentrytitle>sshd_config</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="sshuser-20"><title>Solaris Secure Shell (Task Map)</title><indexterm><primary>task maps</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>administrator task map</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><para>The following task map points to task maps for configuring Solaris Secure Shell and
for using Solaris Secure Shell.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><?PubTbl tgroup dispwid="6.25in"?><colspec colname="colspec0" colwidth="26.24*"/><colspec colname="colspec1" colwidth="41.87*"/><colspec colname="colspec2" colwidth="32.89*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Configure Solaris Secure Shell</para>
</entry><entry><para>Guides administrators in configuring Solaris Secure Shell for users.</para>
</entry><entry><para><olink targetptr="sshuser-24" remap="internal">Configuring Solaris Secure Shell (Task
Map)</olink></para>
</entry>
</row><row><entry><para>Use Solaris Secure Shell</para>
</entry><entry><para>Guides users in using Solaris Secure Shell.</para>
</entry><entry><para><olink targetptr="sshuser-14" remap="internal">Using Solaris Secure Shell (Task Map)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="sshuser-24"><title>Configuring Solaris Secure Shell (Task Map)</title><indexterm><primary>task maps</primary><secondary>configuring Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>administrator task map</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>Solaris Secure Shell</secondary><tertiary>task map</tertiary>
</indexterm><indexterm><primary>configuring</primary><secondary>Solaris Secure Shell task map</secondary>
</indexterm><para>The following task map points to procedures for configuring Solaris Secure Shell.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><?PubTbl tgroup dispwid="6.25in"?><colspec colname="colspec0" colwidth="22.86*"/><colspec colname="colspec1" colwidth="37.47*"/><colspec colname="colspec2" colwidth="40.67*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Configure host-based authentication</para>
</entry><entry><para>Configures host-based authentication on the client and server.</para>
</entry><entry><para><olink targetptr="sshuser-12" remap="internal">How to Set Up Host-Based Authentication
for Solaris Secure Shell</olink></para>
</entry>
</row><row><entry><para>Configure a host to use v1 and v2</para>
</entry><entry><para>Creates public key files for hosts that use v1 and v2 protocols.</para>
</entry><entry><para><olink targetptr="sshuser-22" remap="internal">How to Enable Solaris Secure Shell v1</olink></para>
</entry>
</row><row><entry><para>Configure port forwarding</para>
</entry><entry><para>Enables users to use port forwarding.</para>
</entry><entry><para><olink targetptr="sshuser-30" remap="internal">How to Configure Port Forwarding in Solaris
Secure Shell</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="sshuser-8"><title>Configuring Solaris Secure Shell</title><para>By default, host-based authentication and the use of both protocols
are not enabled in Solaris Secure Shell. Changing these defaults requires administrative
intervention. Also, for port forwarding to work requires administrative intervention.</para><task id="sshuser-12"><title>How to Set Up Host-Based Authentication for Solaris Secure Shell</title><indexterm><primary>configuring</primary><secondary>host-based authentication for Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>authentication methods</primary><secondary>host-based in Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>host-based authentication</primary><secondary>configuring in Solaris Secure Shell</secondary>
</indexterm><tasksummary><para>The following procedure sets up a public key system where the client's
public key is used for authentication on the server. The user must also create
a public/private key pair.</para><para>In the procedure, the terms <emphasis>client</emphasis> and <emphasis>local
host</emphasis> refer to the machine where a user types the <command>ssh</command> command.
The terms <emphasis>server</emphasis> and <emphasis>remote host</emphasis> refer
to the machine that the client is trying to reach.</para>
</tasksummary><procedure>&rolePAstep;<step><para>On the client, enable host-based authentication.</para><para>In
the client configuration file, <filename>/etc/ssh/ssh_config</filename>, type
the following entry:</para><screen>HostbasedAuthentication yes</screen>
</step><step><para>On the server, enable host-based authentication.</para><para>In
the server configuration file, <filename>/etc/ssh/sshd_config</filename>,
type the same entry:</para><screen>HostbasedAuthentication yes</screen>
</step><step><para>On the server, configure a file that enables the client to be
recognized as a trusted host.</para><para>For more information, see the <literal>FILES</literal> section of the <olink targetdoc="group-refman" targetptr="sshd-1m" remap="external"><citerefentry><refentrytitle>sshd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><stepalternatives><step><para>Add the client as an entry to the server's <filename>/etc/ssh/shosts.equiv</filename> file.</para><screen><replaceable>client-host</replaceable></screen>
</step><step><para>Or, you can instruct users to add an entry for the client to their <filename>~/.shosts</filename> file on the server.</para><screen><replaceable>client-host</replaceable></screen>
</step>
</stepalternatives>
</step><step><para>On the server, ensure that the <command>sshd</command> daemon
can access the list of trusted hosts.</para><para>Set <literal>IgnoreRhosts</literal> to <literal>no</literal> in the <filename>/etc/ssh/sshd_config</filename> file.</para><screen># sshd_config
IgnoreRhosts no</screen>
</step><step><para>Ensure that users of Solaris Secure Shell at your site have accounts on both
hosts.</para>
</step><step><para>Do one of the following to put the client's public key on the
server.</para><stepalternatives><step><para>Modify the <command>sshd_config</command> file on the server,
then instruct your users to add the client's public host keys to their <filename>~/.ssh/known_hosts</filename> file.</para><screen># sshd_config
IgnoreUserKnownHosts no</screen><para>For user instructions, see <olink targetptr="sshuser-33" remap="internal">How to Generate
a Public/Private Key Pair for Use With Solaris Secure Shell</olink>.</para>
</step><step><para>Copy the client's public key to the server.</para><para>The host
keys are stored in the <filename>/etc/ssh</filename> directory. The keys are
typically generated by the <command>sshd</command> daemon on first boot.</para><substeps><step><para>Add the key to the <filename>/etc/ssh/ssh_known_hosts</filename> file
on the server.</para><para>On the client, type the command on one line with
no backslash.</para><screen># <userinput>cat /etc/ssh/ssh_host_dsa_key.pub | ssh</userinput> <replaceable>RemoteHost</replaceable> <userinput>\</userinput>
<userinput>'cat &gt;&gt; /etc/ssh/ssh_known_hosts &amp;&amp; echo "Host key copied"'</userinput></screen>
</step><step><para>When you are prompted, supply your login password.</para><para>When
the file is copied, the message &ldquo;Host key copied&rdquo; is displayed.</para><para>Each line in the <filename>/etc/ssh/ssh_known_hosts</filename> file
consists of fields that are separated by spaces:</para><screen><replaceable>hostnames algorithm-name publickey comment</replaceable></screen>
</step><step><para>Edit the <filename>/etc/ssh/ssh_known_hosts</filename> file and
add <replaceable>RemoteHost</replaceable> as the first field in the copied
entry.</para><screen>## /etc/ssh/ssh_known_hosts File
<replaceable>RemoteHost</replaceable> <replaceable>&lt;copied entry&gt;</replaceable></screen>
</step>
</substeps>
</step>
</stepalternatives>
</step>
</procedure><example id="sshuser-29"><title>Setting Up Host-based Authentication</title><itemizedlist><para>In the following example, each host is configured as a server and as
a client. A user on either host can initiate an <command>ssh</command> connection
to the other host. The following configuration makes each host a server and
a client:</para><listitem><para>On each host, the Solaris Secure Shell configuration files contain the following
entries:</para><screen># /etc/ssh/ssh_config
HostBasedAuthentication yes
# 
# /etc/ssh/sshd_config
HostBasedAuthentication yes
IgnoreRhosts no</screen>
</listitem><listitem><para>On each host, the <filename>shosts.equiv</filename> file contains
an entry for the other host:</para><screen># /etc/ssh/shosts.equiv on machine2
machine1</screen><screen># /etc/ssh/shosts.equiv on machine1
machine2</screen>
</listitem><listitem><para>The public key for each host is in the <filename>/etc/ssh/ssh_known_hosts</filename> file on the other host:</para><screen># /etc/ssh/ssh_known_hosts on machine2
&hellip; machine1</screen><screen># /etc/ssh/ssh_known_hosts on machine1
&hellip; machine2</screen>
</listitem><listitem><para>Users have an account on both hosts:</para><screen># /etc/passwd on machine1
jdoe:x:3111:10:J Doe:/home/jdoe:/bin/sh</screen><screen># /etc/passwd on machine2
jdoe:x:3111:10:J Doe:/home/jdoe:/bin/sh</screen>
</listitem>
</itemizedlist>
</example>
</task><task id="sshuser-22"><title>How to Enable Solaris Secure Shell v1</title><tasksummary><para>This procedure is useful when a host interoperates with hosts that run
v1 and v2.</para>
</tasksummary><procedure>&rolePAstep;<step><para>Configure the host to use both Solaris Secure Shell protocols.</para><para>Edit
the <filename>/etc/ssh/sshd_config</filename> file.</para><screen># Protocol 2
Protocol 2,1</screen>
</step><step><para>Provide a separate file for the host key for v1.</para><para>Add
a <literal>HostKey</literal> entry to the <filename>/etc/ssh/sshd_config</filename> file.</para><screen>HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<userinput>HostKey /etc/ssh/ssh_host_rsa1_key</userinput></screen>
</step><step><para>Generate a host key for v1.</para><screen># <userinput>ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_rsa1_key -N ''</userinput></screen><variablelist><varlistentry><term><option>t rsa1</option></term><listitem><para>Indicates the RSA algorithm for v1.</para>
</listitem>
</varlistentry><varlistentry><term><option>f</option></term><listitem><para>Indicates the file that holds the host key.</para>
</listitem>
</varlistentry><varlistentry><term><option>N ''</option></term><listitem><para>Indicates that no passphrase is required.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>Restart the <command>sshd</command> daemon.</para><screen># <userinput>svcadm restart network/ssh:default</userinput></screen><para>You can also reboot the system.</para>
</step>
</procedure>
</task><task id="sshuser-30"><title>How to Configure Port Forwarding in Solaris Secure Shell</title><indexterm><primary>configuring</primary><secondary>port forwarding in Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>port forwarding</primary><secondary>configuring in Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>configuring port forwarding</secondary>
</indexterm><tasksummary><para>Port forwarding enables a local port be forwarded to a remote host.
Effectively, a socket is allocated to listen to the port on the local side.
Similarly, a port can be specified on the remote side.</para><note><para><indexterm><primary>Solaris Secure Shell</primary><secondary>TCP and</secondary></indexterm><indexterm><primary>UDP</primary><secondary>Solaris Secure Shell and</secondary></indexterm><indexterm><primary>UDP</primary><secondary>port forwarding and</secondary></indexterm><indexterm><primary>TCP</primary><secondary>Solaris Secure Shell and</secondary></indexterm>Solaris Secure Shell port forwarding
must use TCP connections. Solaris Secure Shell does not support UDP connections for port
forwarding.</para>
</note>
</tasksummary><procedure>&rolePAstep;<step><para>Configure a Solaris Secure Shell setting on the remote server to allow port forwarding.</para><para><indexterm><primary><literal>AllowTcpForwarding</literal> keyword</primary><secondary>changing</secondary></indexterm>Change the value of <literal>AllowTcpForwarding</literal> to <literal>yes</literal> in the <filename>/etc/ssh/sshd_config</filename> file.</para><screen># Port forwarding
AllowTcpForwarding yes</screen>
</step><step><para><indexterm><primary>restarting</primary><secondary><command>ssh</command> service</secondary></indexterm><indexterm><primary>restarting</primary><secondary><command>sshd</command> daemon</secondary></indexterm><indexterm><primary><command>svcadm</command> command</primary><secondary>restarting Solaris Secure Shell</secondary></indexterm><indexterm><primary>service management facility</primary><secondary>restarting Solaris Secure Shell</secondary></indexterm>Restart the Solaris Secure Shell service.</para><screen>remoteHost# <userinput>svcadm restart network/ssh:default</userinput></screen><para>For information on managing persistent services, see <olink targetdoc="group-sa" targetptr="hbrunlevels-25516" remap="external">Chapter 15, <citetitle remap="chapter">Managing Services (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink> and
the <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</step><step><para>Verify that port forwarding can be used.</para><screen>remoteHost# <userinput>/usr/bin/pgrep -lf sshd</userinput>
 1296 ssh -L 2001:remoteHost:23 remoteHost</screen>
</step>
</procedure>
</task>
</sect1><sect1 id="sshuser-14"><title>Using Solaris Secure Shell (Task Map)</title><indexterm><primary>task maps</primary><secondary>using Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>using</primary><secondary>Solaris Secure Shell task map</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>using Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>user procedures</secondary>
</indexterm><para>The following task map points to user procedures for using Solaris Secure Shell.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><?PubTbl tgroup dispwid="6.25in"?><colspec colname="colspec0" colwidth="24.49*"/><colspec colname="colspec1" colwidth="42.80*"/><colspec colname="colspec2" colwidth="33.71*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Create a public/private key pair</para>
</entry><entry><para>Enables access to Solaris Secure Shell for sites that require public-key authentication.</para>
</entry><entry><para><olink targetptr="sshuser-33" remap="internal">How to Generate a Public/Private Key Pair
for Use With Solaris Secure Shell</olink></para>
</entry>
</row><row><entry><para>Change your passphrase</para>
</entry><entry><para>Changes the phrase that authenticates your private key.</para>
</entry><entry><para><olink targetptr="sshuser-10" remap="internal">How to Change the Passphrase for a Solaris
Secure Shell Private Key</olink></para>
</entry>
</row><row><entry><para>Log in with Solaris Secure Shell</para>
</entry><entry><para>Provides encrypted Solaris Secure Shell communication when logging in remotely. The
process is similar to using the <command>rsh</command> command.</para>
</entry><entry><para><olink targetptr="sshuser-34" remap="internal">How to Log In to a Remote Host With Solaris
Secure Shell</olink></para>
</entry>
</row><row><entry morerows="1"><para>Log in to Solaris Secure Shell without being prompted for a password </para>
</entry><entry morerows="1"><para>Enables login by using an agent which provides your password to Solaris Secure Shell.</para>
</entry><entry><para><olink targetptr="sshuser-35" remap="internal">How to Reduce Password Prompts in Solaris
Secure Shell</olink></para>
</entry>
</row><row><entry><para><olink targetptr="sshuser-36" remap="internal">How to Set Up the ssh-agent Command to
Run Automatically in CDE</olink></para>
</entry>
</row><row><entry><para>Use port forwarding in Solaris Secure Shell</para>
</entry><entry><para>Specifies a local port or a remote port to be used in a Solaris Secure Shell connection
over TCP.</para>
</entry><entry><para><olink targetptr="sshuser-37" remap="internal">How to Use Port Forwarding in Solaris
Secure Shell</olink></para>
</entry>
</row><row><entry><para>Copy files with Solaris Secure Shell</para>
</entry><entry><para>Securely copies files between hosts.</para>
</entry><entry><para><olink targetptr="sshuser-38" remap="internal">How to Copy Files With Solaris Secure
Shell</olink></para>
</entry>
</row><row><entry><para>Securely connect from a host inside a firewall to a host outside the
firewall</para>
</entry><entry><para>Uses Solaris Secure Shell commands that are compatible with HTTP or SOCKS5 to connect
hosts that are separated by a firewall.</para>
</entry><entry><para><olink targetptr="sshuser-46" remap="internal">How to Set Up Default Connections to Hosts
Outside a Firewall</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="sshuser-15"><title>Using Solaris Secure Shell</title><para>Solaris Secure Shell provides secure access between a local shell and a remote shell.
For more information, see the <olink targetdoc="group-refman" targetptr="ssh-config-4" remap="external"><citerefentry><refentrytitle>ssh_config</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="ssh-1" remap="external"><citerefentry><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para><task id="sshuser-33"><title>How to Generate a Public/Private Key Pair for
Use With Solaris Secure Shell</title><indexterm><primary>generating</primary><secondary>keys for Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>generating keys</secondary>
</indexterm><indexterm><primary>public keys</primary><secondary>generating public-private key pair</secondary>
</indexterm><indexterm><primary>keys</primary><secondary>generating for Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>creating keys</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>Solaris Secure Shell keys</secondary>
</indexterm><indexterm><primary>generating</primary><secondary>Solaris Secure Shell keys</secondary>
</indexterm><indexterm><primary>keys</primary><secondary>creating for Solaris Secure Shell</secondary>
</indexterm><indexterm><primary><command>ssh-keygen</command> command</primary><secondary>using</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>remote logins with Solaris Secure Shell</secondary>
</indexterm><tasksummary><para>Users must generate a public/private key pair when their site implements
host-based authentication or user public-key authentication. For additional
options, see the <olink targetdoc="group-refman" targetptr="ssh-keygen-1" remap="external"><citerefentry><refentrytitle>ssh-keygen</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para>
</tasksummary><taskprerequisites><para>Determine from your system administrator if host-based authentication
is configured.</para>
</taskprerequisites><procedure><step><para>Start the key generation program.</para><screen>myLocalHost% <userinput>ssh-keygen -t rsa</userinput>
Generating public/private rsa key pair.
&hellip;</screen><para>where <option>t</option> is the type of algorithm, one of <literal>rsa</literal>, <literal>dsa</literal>, or <literal>rsa1</literal>.</para>
</step><step><para>Specify the path to the file that will hold the key.</para><para>By
default, the file name <filename>id_rsa</filename>, which represents an RSA
v2 key, appears in parentheses. You can select this file by pressing the <keysym>Return</keysym> key. Or, you can type an alternative file name.</para><screen>Enter file in which to save the key (/home/jdoe/.ssh/id_rsa):<lineannotation>&lt;Press Return&gt;</lineannotation></screen><para>The file name of the public key is created automatically by appending
the string <literal>.pub</literal> to the name of the private key file.</para>
</step><step><para>Type a passphrase for using your key.</para><para>This passphrase
is used for encrypting your private key. A null entry is <emphasis>strongly
discouraged</emphasis>. Note that the passphrase is not displayed when you
type it in.</para><screen>Enter passphrase (empty for no passphrase): <lineannotation>&lt;Type passphrase&gt;</lineannotation></screen>
</step><step><para>Retype the passphrase to confirm it.</para><screen>Enter same passphrase again: <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Your identification has been saved in /home/jdoe/.ssh/id_rsa.
Your public key has been saved in /home/jdoe/.ssh/id_rsa.pub.
The key fingerprint is:
0e:fb:3d:57:71:73:bf:58:b8:eb:f3:a3:aa:df:e0:d1 jdoe@myLocalHost</screen>
</step><step><para>Check the results.</para><para>Check that the path to the key
file is correct.</para><screen>% <userinput>ls ~/.ssh</userinput>
id_rsa
id_rsa.pub</screen><para>At this point, you have created a public/private key pair.</para>
</step><step><para>Choose the appropriate option:</para><stepalternatives><step id="sshuser-hostkeycopy-1"><para>If your administrator has configured
host-based authentication, you might need to copy the local host's public
key to the remote host.</para><para>You can now log in to the remote host.
For details, see <olink targetptr="sshuser-34" remap="internal">How to Log In to a Remote Host
With Solaris Secure Shell</olink>.</para><substeps><step><para>Type the command on one line with no backslash.</para><screen>% <userinput>cat /etc/ssh/ssh_host_dsa_key.pub | ssh</userinput> <replaceable>RemoteHost</replaceable> <userinput>\</userinput>
<userinput>'cat &gt;&gt; ~./ssh/known_hosts &amp;&amp; echo "Host key copied"'</userinput></screen>
</step><step><para>When you are prompted, supply your login password.</para><screen>Enter password: <lineannotation>&lt;Type password&gt;</lineannotation>
Host key copied
%</screen>
</step>
</substeps>
</step><step><para>If your site uses user authentication with public keys, populate
your <filename>authorized_keys</filename> file on the remote host.</para><substeps><step><para>Copy your public key to the remote host.</para><para>Type the
command on one line with no backslash.</para><screen>myLocalHost% <userinput>cat $HOME/.ssh/id_rsa.pub | ssh myRemoteHost \</userinput>
<userinput>'cat &gt;&gt; .ssh/authorized_keys &amp;&amp; echo "Key copied"'</userinput></screen>
</step><step><para>When you are prompted, supply your login password.</para><para>When
the file is copied, the message &ldquo;Key copied&rdquo; is displayed.</para><screen>Enter password: <lineannotation>Type login password</lineannotation>
Key copied
myLocalHost%</screen>
</step>
</substeps>
</step>
</stepalternatives>
</step><step performance="optional"><para>Reduce the prompting for passphrases.</para><para>For a procedure, see <olink targetptr="sshuser-35" remap="internal">How to Reduce Password
Prompts in Solaris Secure Shell</olink>. For more information, see the <olink targetdoc="group-refman" targetptr="ssh-agent-1" remap="external"><citerefentry><refentrytitle>ssh-agent</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="ssh-add-1" remap="external"><citerefentry><refentrytitle>ssh-add</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para>
</step>
</procedure><example><title>Establishing a v1 RSA Key for a User</title><para><indexterm><primary>passphrases</primary><secondary>using in Solaris Secure Shell</secondary></indexterm>In the following example, the user can
contact hosts that run v1 of the Solaris Secure Shell protocol. To be authenticated by v1
hosts, the user creates a v1 key, then copies the public key portion to the
remote host.</para><screen>myLocalHost% <userinput>ssh-keygen -t rsa1 -f /home/jdoe/.ssh/identity</userinput>
Generating public/private rsa key pair.
&hellip;
Enter passphrase (empty for no passphrase): <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Enter same passphrase again: <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Your identification has been saved in /home/jdoe/.ssh/identity.
Your public key has been saved in /home/jdoe/.ssh/identity.pub.
The key fingerprint is:
&hellip;
myLocalHost% <userinput>ls ~/.ssh</userinput>
id_rsa
id_rsa.pub
identity
identity.pub
myLocalHost% <userinput>cat $HOME/.ssh/identity.pub | ssh myRemoteHost \</userinput>
<userinput>'cat &gt;&gt; .ssh/authorized_keys &amp;&amp; echo "Key copied"'</userinput></screen>
</example>
</task><task id="sshuser-10"><title>How to Change the Passphrase for a Solaris Secure Shell Private
Key</title><indexterm><primary>changing</primary><secondary>passphrase for Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>changing passphrase</secondary>
</indexterm><indexterm><primary>public keys</primary><secondary>changing passphrase</secondary>
</indexterm><indexterm><primary>passphrases</primary><secondary>changing for Solaris Secure Shell</secondary>
</indexterm><tasksummary><para>The following procedure does not change the private key. The procedure
changes the authentication mechanism for the private key, the passphrase.
For more information, see the <olink targetdoc="group-refman" targetptr="ssh-keygen-1" remap="external"><citerefentry><refentrytitle>ssh-keygen</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</tasksummary><procedure remap="single-step"><step><para>Change your passphrase.</para><para>Type the <command>ssh-keygen</command> command
with the <option>p</option> option, and answer the prompts.</para><screen>myLocalHost% <userinput>ssh-keygen -p</userinput>
Enter file which contains the private key (/home/jdoe/.ssh/id_rsa):<lineannotation>&lt;Press Return&gt;</lineannotation>
Enter passphrase (empty for no passphrase): <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Enter same passphrase again:   <lineannotation>&lt;Type passphrase&gt;</lineannotation></screen><para>where <option>p</option> requests changing the passphrase of a private
key file.</para>
</step>
</procedure>
</task><task id="sshuser-34"><title>How to Log In to a Remote Host With Solaris Secure Shell</title><indexterm><primary>logging in</primary><secondary>with Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>logging in to remote host</secondary>
</indexterm><indexterm><primary>secure connection</primary><secondary>logging in</secondary>
</indexterm><indexterm><primary><command>ssh</command> command</primary><secondary>using</secondary>
</indexterm><procedure><step><para>Start a Solaris Secure Shell session.</para><para>Type the <command>ssh</command> command,
and specify the name of the remote host.</para><screen>myLocalHost% <userinput>ssh myRemoteHost</userinput></screen><para>A prompt questions the authenticity of the remote host:</para><screen>The authenticity of host 'myRemoteHost' can't be established.
RSA key fingerprint in md5 is: 04:9f:bd:fc:3d:3e:d2:e7:49:fd:6e:18:4f:9c:26
Are you sure you want to continue connecting(yes/no)? </screen><para>This prompt is normal for initial connections to remote hosts.</para>
</step><step><para>If prompted, verify the authenticity of the remote host key.</para><stepalternatives><step><para>If you cannot confirm the authenticity of the remote host, type <userinput>no</userinput> and contact your system administrator.</para><screen>Are you sure you want to continue connecting(yes/no)? <userinput>no</userinput></screen><para>The administrator is responsible for updating the global <filename>/etc/ssh/ssh_known_hosts</filename> file. An updated <filename>ssh_known_hosts</filename> file prevents
this prompt from appearing.</para>
</step><step><para>If you confirm the authenticity of the remote host, answer the
prompt and continue to the next step.</para><screen>Are you sure you want to continue connecting(yes/no)? <userinput>yes</userinput></screen>
</step>
</stepalternatives>
</step><step><para><indexterm><primary>passphrases</primary><secondary>example</secondary></indexterm>Authenticate yourself to Solaris Secure Shell.</para><substeps><step><para>When prompted, type your passphrase.</para><screen>Enter passphrase for key '/home/jdoe/.ssh/id_rsa': <lineannotation>&lt;Type passphrase&gt;</lineannotation></screen>
</step><step><para>When prompted, type your account password.</para><screen>jdoe@myRemoteHost's password: <lineannotation>&lt;Type password&gt;</lineannotation>
Last login: Fri Jul 20 14:24:10 2001 from myLocalHost
myRemoteHost%</screen>
</step>
</substeps>
</step><step><para><indexterm><primary>encrypting</primary><secondary>communications between hosts</secondary></indexterm>Conduct transactions on the remote host.</para><para>The commands that you send are encrypted. Any responses that you receive
are encrypted.</para>
</step><step><para>Close the Solaris Secure Shell connection.</para><para>When you are finished,
type <userinput>exit</userinput> or use your usual method for exiting your
shell.</para><screen>myRemoteHost% <userinput>exit</userinput>
myRemoteHost% logout
Connection to myRemoteHost closed
myLocalHost%</screen>
</step>
</procedure>
</task><task id="sshuser-35"><title>How to Reduce Password Prompts in Solaris Secure Shell</title><indexterm><primary>using</primary><secondary><command>ssh-agent</command> daemon</secondary>
</indexterm><indexterm><primary>daemons</primary><secondary><command>ssh-agent</command></secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>logging in fewer prompts</secondary>
</indexterm><indexterm><primary><command>ssh-add</command> command</primary><secondary>storing private keys</secondary>
</indexterm><indexterm><primary>passphrases</primary><secondary>using in Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>using</primary><secondary><command>ssh-add</command> command</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>using without password</secondary>
</indexterm><indexterm><primary><command>ssh-agent</command> command</primary><secondary>from command line</secondary>
</indexterm><indexterm><primary>passwords</primary><secondary>eliminating in Solaris Secure Shell</secondary>
</indexterm><indexterm><primary><command>ssh-add</command> command</primary><secondary>example</secondary>
</indexterm><indexterm><primary>agent daemon</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>access</primary><secondary>login authentication with Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>access</primary><secondary>security</secondary><tertiary>login authentication</tertiary>
</indexterm><tasksummary><para>If you do not want to type your passphrase and your password to use Solaris Secure Shell,
you can use the agent daemon. Start the daemon at the beginning of the session.
Then, store your private keys with the agent daemon by using the <command>ssh-add</command> command. If you have different accounts on different hosts, add
the keys that you need for the session.</para><para>You can start the agent daemon manually when needed, as described in
the following procedure. Or, you can set the agent daemon to run automatically
at the start of every session as described in <olink targetptr="sshuser-36" remap="internal">How
to Set Up the ssh-agent Command to Run Automatically in CDE</olink>.</para>
</tasksummary><procedure><step><para>Start the agent daemon.</para><screen>myLocalHost% <userinput>ssh-agent</userinput></screen>
</step><step><para>Verify that the agent daemon has been started.</para><screen>myLocalHost% <userinput>eval `ssh-agent`</userinput>
Agent pid 9892</screen>
</step><step><para>Add your private key to the agent daemon.</para><para>Type the <command>ssh-add</command> command.</para><screen>myLocalHost% <userinput>ssh-add</userinput>
Enter passphrase for /home/jdoe/.ssh/id_rsa: <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Identity added: /home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa)
myLocalHost%</screen>
</step><step><para>Start a Solaris Secure Shell session.</para><screen>myLocalHost% <userinput>ssh myRemoteHost</userinput></screen><para>You are not prompted for a passphrase.</para>
</step>
</procedure><example id="sshuser-25"><title>Using <command>ssh-add</command> Options</title><indexterm><primary><command>ssh-add</command> command</primary><secondary>example</secondary>
</indexterm><para>In this example, <literal>jdoe</literal> adds two keys to the agent
daemon. The <option>l</option> option is used to list all keys that are stored
in the daemon. At the end of the session, the <option>D</option> option is
used to remove all the keys from the agent daemon.</para><screen>myLocalHost% <userinput>ssh-agent</userinput>
myLocalHost% <userinput>ssh-add</userinput>
Enter passphrase for /home/jdoe/.ssh/id_rsa: <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Identity added: /home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa)
myLocalHost% <userinput>ssh-add /home/jdoe/.ssh/id_dsa</userinput>
Enter passphrase for /home/jdoe/.ssh/id_dsa: <lineannotation>&lt;Type passphrase&gt;</lineannotation>
Identity added:
/home/jdoe/.ssh/id_dsa(/home/jdoe/.ssh/id_dsa)

myLocalHost% <userinput>ssh-add -l</userinput>
md5 1024 0e:fb:3d:53:71:77:bf:57:b8:eb:f7:a7:aa:df:e0:d1
/home/jdoe/.ssh/id_rsa(RSA)
md5 1024 c1:d3:21:5e:40:60:c5:73:d8:87:09:3a:fa:5f:32:53
/home/jdoe/.ssh/id_dsa(DSA)

<lineannotation>User conducts Solaris Secure Shell transactions</lineannotation></screen><screen>myLocalHost% <userinput>ssh-add -D</userinput>
Identity removed:
/home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa.pub)
/home/jdoe/.ssh/id_dsa(DSA)</screen>
</example>
</task><task id="sshuser-36"><title>How to Set Up the <command>ssh-agent</command> Command
to Run Automatically in CDE</title><indexterm><primary>configuring</primary><secondary><command>ssh-agent</command> daemon</secondary>
</indexterm><indexterm><primary><command>ssh-agent</command> command</primary><secondary>configuring for CDE</secondary>
</indexterm><indexterm><primary>user scripts</primary><secondary>configuring for <command>ssh-agent</command> daemon in CDE</secondary>
</indexterm><indexterm><primary><command>ssh-agent</command> command</primary><secondary>in scripts</secondary>
</indexterm><indexterm><primary>passwords</primary><secondary>eliminating in Solaris Secure Shell in CDE</secondary>
</indexterm><indexterm><primary><filename>.dtprofile</filename> script</primary><secondary>use in Solaris Secure Shell</secondary>
</indexterm><tasksummary><para>If you use CDE, you can avoid providing your passphrase and password
whenever you use Solaris Secure Shell by automatically starting an agent daemon, <command>ssh-agent</command>. You can start the agent daemon from the <filename>.dtprofile</filename> script.
To add your passphrase and password to the agent daemon, see <olink targetptr="sshuser-25" remap="internal">Example&nbsp;19&ndash;3</olink>.</para><caution><para>If you use the Sun <trademark>Java</trademark> Desktop System
(Java DS), do not set up the <command>ssh-agent</command> command to run automatically.
Because the killing of the <command>ssh-agent</command> process is controlled
by a CDE interface, when you exit the Java DS, the daemon continues to run.
For example, if you start the daemon in a CDE session, move to a Java DS session,
and then log out, the daemon continues to run.</para><para>A running daemon
uses system resources. Although no known issues are associated with leaving
the <command>ssh-agent</command> daemon running, the daemon contains a password,
which could create a security risk.</para>
</caution>
</tasksummary><procedure><step><para>Start the agent daemon automatically in a user startup script.</para><para>Add the following lines to the end of the <filename>$HOME/.dtprofile</filename> script:</para><screen>if [ "$SSH_AUTH_SOCK" = "" -a -x /usr/bin/ssh-agent ]; then
                eval `/usr/bin/ssh-agent`
fi</screen>
</step><step><para>Terminate the agent daemon when you exit the CDE session.</para><para>Add the following lines to the <filename>$HOME/.dt/sessions/sessionexit</filename> script:</para><screen>if [ "$SSH_AGENT_PID" != "" -a -x /usr/bin/ssh-agent ]; then
                /usr/bin/ssh-agent -k
fi</screen><para>This entry ensures that no one can use the Solaris Secure Shell agent after a CDE session
is terminated. Because the script uses a CDE-specific interface, <filename>sessionexit</filename>, this procedure does not terminate the agent daemon in a Sun Java Desktop System session.</para>
</step>
</procedure>
</task><task id="sshuser-37"><title>How to Use Port Forwarding in Solaris Secure Shell</title><indexterm><primary>Solaris Secure Shell</primary><secondary>using port forwarding</secondary>
</indexterm><indexterm><primary sortas="l1"><option>L</option> option</primary><secondary><command>ssh</command> command</secondary>
</indexterm><indexterm><primary sortas="r1"><option>R</option> option</primary><secondary><command>ssh</command> command</secondary>
</indexterm><indexterm><primary><command>ssh</command> command</primary><secondary>port forwarding options</secondary>
</indexterm><tasksummary><para>You can specify that a local port be forwarded to a remote host. Effectively,
a socket is allocated to listen to the port on the local side. The connection
from this port is made over a secure channel to the remote host. For example,
you might specify port <literal>143</literal> to obtain email remotely with
IMAP4. Similarly, a port can be specified on the remote side.</para>
</tasksummary><taskprerequisites><para>To use port forwarding, the administrator must have enabled port forwarding
on the remote Solaris Secure Shell server. For details, see <olink targetptr="sshuser-30" remap="internal">How
to Configure Port Forwarding in Solaris Secure Shell</olink>.</para>
</taskprerequisites><procedure remap="single-step"><step><para>To use secure port forwarding, choose one of the following options:</para><stepalternatives><step><para>To set a local port to receive secure communication from a remote
port, specify both ports.</para><para>Specify the local port that listens
for remote communication. Also, specify the remote host and the remote port
that forward the communication.</para><screen>myLocalHost% ssh -L <replaceable>localPort:remoteHost:remotePort</replaceable> </screen>
</step><step><para>To set a remote port to receive a secure connection from a local
port, specify both ports.</para><para>Specify the remote port that listens
for remote communication. Also, specify the local host and the local port
that forward the communication.</para><screen>myLocalHost% ssh -R <replaceable>remotePort:localhost:localPort</replaceable></screen>
</step>
</stepalternatives>
</step>
</procedure><example id="sshuser-27"><title>Using Local Port Forwarding to Receive Mail</title><indexterm><primary>mail</primary><secondary>using with Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>local port forwarding</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>forwarding mail</secondary>
</indexterm><indexterm><primary>port forwarding</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><para>The following example demonstrates how you can use local port forwarding
to receive mail securely from a remote server.</para><screen>myLocalHost% <userinput>ssh -L 9143:myRemoteHost:143 myRemoteHost</userinput> </screen><para>This command forwards connections from port <literal>9143</literal> on <literal>myLocalHost</literal> to port <literal>143</literal>. Port <literal>143</literal> is
the IMAP v2 server port on <literal>myRemoteHost</literal>. When the user
launches a mail application, the user needs to specify the local port number,
as shown in the following dialog box.</para><mediaobject><imageobject><imagedata entityref="maillogin.tiff"/>
</imageobject><textobject><simpara>Dialog box titled Mailer - Login. The IMAP Server field
shows the server name followed by a colon and the port number.</simpara>
</textobject>
</mediaobject><para>Do not confuse <literal>localhost</literal> in the dialog box with <literal>myLocalHost</literal>. <literal>myLocalHost</literal> is a hypothetical host
name. <literal>localhost</literal> is a keyword that identifies your local
system.</para>
</example><example id="sshuser-ex-2"><title>Using Remote Port Forwarding to Communicate Outside of a Firewall</title><indexterm><primary>Solaris Secure Shell</primary><secondary>remote port forwarding</secondary>
</indexterm><indexterm><primary>port forwarding</primary><secondary>Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>local port forwarding</secondary>
</indexterm><para>This example demonstrates how a user in an enterprise environment can
forward connections from a host on an external network to a host inside a
corporate firewall.</para><screen>myLocalHost% <userinput>ssh -R 9022:myLocalHost:22 myOutsideHost</userinput></screen><para>This command forwards connections from port <literal>9022</literal> on <literal>myOutsideHost</literal> to port <literal>22</literal>, the <command>sshd</command> server,
on the local host.</para><screen>myOutsideHost% <userinput>ssh -p 9022 localhost</userinput>
myLocalHost%</screen>
</example>
</task><task id="sshuser-38"><title>How to Copy Files With Solaris Secure Shell</title><indexterm><primary>copying</primary><secondary>files using Solaris Secure Shell</secondary>
</indexterm><indexterm><primary>files</primary><secondary>copying with Solaris Secure Shell</secondary>
</indexterm><indexterm><primary><command>scp</command> command</primary><secondary>copying files with</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary><command>scp</command> command</secondary>
</indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>copying files</secondary>
</indexterm><tasksummary><para>The following procedure shows how to use the <command>scp</command> command
to copy encrypted files between hosts. You can copy encrypted files either
between a local host and a remote host, or between two remote hosts. The command
operates similarly to the <command>rcp</command> command, except that the <command>scp</command> command prompts for authentication. For more information, see
the <olink targetdoc="group-refman" targetptr="scp-1" remap="external"><citerefentry><refentrytitle>scp</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para><para>You can also use the <command>sftp</command>, a more secure form of
the <command>ftp</command> command. For more information, see the <olink targetdoc="group-refman" targetptr="sftp-1" remap="external"><citerefentry><refentrytitle>sftp</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. For an example,
see <olink targetptr="sshuser-11" remap="internal">Example&nbsp;19&ndash;6</olink>.</para>
</tasksummary><procedure><step><para>Start the secure copy program.</para><para>Specify the source
file, the user name at the remote destination, and the destination directory.</para><screen>myLocalHost% <userinput>scp <replaceable>myfile.1 jdoe@myRemoteHost:~</replaceable></userinput></screen>
</step><step><para>Supply your passphrase when prompted.</para><screen>Enter passphrase for key '/home/jdoe/.ssh/id_rsa': <lineannotation>&lt;Type passphrase&gt;</lineannotation>
myfile.1       25% |*******                      |    640 KB  0:20 ETA 
myfile.1 </screen><itemizedlist><para>After you type the passphrase, a progress meter is displayed. See the
second line in the preceding output. The progress meter displays:</para><listitem><para>The file name</para>
</listitem><listitem><para>The percentage of the file that has been transferred</para>
</listitem><listitem><para>A series of asterisks that indicate the percentage of the
file that has been transferred</para>
</listitem><listitem><para>The quantity of data transferred</para>
</listitem><listitem><para>The estimated time of arrival, or ETA, of the complete file
(that is, the remaining amount of time)</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="sshuser-11"><title>Specifying a Port When Using the <command>sftp</command> Command</title><indexterm><primary><command>sftp</command> command</primary><secondary>copying files with</secondary>
</indexterm><para>In this example, the user wants the <command>sftp</command> command
to use a specific port. The user uses the <option>o</option> option to specify
the port.</para><screen>% <userinput>sftp -o port=2222 guest@RemoteFileServer</userinput></screen>
</example>
</task><task id="sshuser-46"><title>How to Set Up Default Connections to
Hosts Outside a Firewall</title><indexterm><primary>Solaris Secure Shell</primary><secondary>connecting outside firewall</secondary><tertiary>from configuration file</tertiary>
</indexterm><indexterm><primary>firewall systems</primary><secondary>outside connections with Solaris Secure Shell</secondary><tertiary>from configuration file</tertiary>
</indexterm><tasksummary><para><indexterm><primary>firewall systems</primary><secondary>secure host connections</secondary></indexterm><indexterm><primary>secure connection</primary><secondary>across a firewall</secondary></indexterm><indexterm><primary>security</primary><secondary>across insecure network</secondary></indexterm><indexterm><primary>Solaris Secure Shell</primary><secondary>connecting across a firewall</secondary></indexterm>You can use Solaris Secure Shell to make a connection from a host inside a firewall
to a host outside the firewall. This task is done by specifying a proxy command
for <command>ssh</command> either in a configuration file or as an option
on the command line. For the command-line option, see <olink targetptr="sshuser-52" remap="internal">Example&nbsp;19&ndash;7</olink>.</para><para>In general, you can customize your <command>ssh</command> interactions
through a configuration file.</para><itemizedlist><listitem><para>You can customize either your own personal file in <filename>~/.ssh/config</filename>.</para>
</listitem><listitem><para>Or, you can use the settings in the administrative configuration
file,  <filename>/etc/ssh/ssh_config</filename>.</para>
</listitem>
</itemizedlist><para>The files can be customized with two types of proxy commands. One proxy
command is for HTTP connections. The other proxy command is for SOCKS5 connections.
For more information, see the <olink targetdoc="group-refman" targetptr="ssh-config-4" remap="external"><citerefentry><refentrytitle>ssh_config</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</tasksummary><procedure><step id="sshuser-step-85"><para>Specify the proxy commands and hosts in a
configuration file.</para><para>Use the following syntax to add as many lines
as you need:</para><screen>[Host <replaceable>outside-host</replaceable>]
ProxyCommand <replaceable>proxy-command</replaceable> [<option>h</option> <replaceable>proxy-server</replaceable>] \
[<option>p</option> <replaceable>proxy-port</replaceable>] <replaceable>outside-host</replaceable>|%h <replaceable>outside-port</replaceable>|%p</screen><variablelist termlength="wholeline"><varlistentry><term><literal>Host</literal> <replaceable>outside-host</replaceable></term><listitem><para><indexterm><primary>wildcard characters</primary><secondary>for hosts in Solaris Secure Shell</secondary></indexterm>Limits the proxy command
specification to instances when a remote host name is specified on the command
line. If you use a wildcard for <replaceable>outside-host</replaceable>, you
apply the proxy command specification to a set of hosts.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>proxy-command</replaceable></term><listitem><para>Specifies the proxy command.</para><itemizedlist><para>The command can be either of the following:</para><listitem><para><command>/usr/lib/ssh/ssh-http-proxy-connect</command> for
HTTP connections</para>
</listitem><listitem><para><command>/usr/lib/ssh/ssh-socks5-proxy-connect</command> for
SOCKS5 connections</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry><varlistentry><term><option>h</option> <replaceable>proxy-server</replaceable> and <option>p</option> <replaceable>proxy-port</replaceable></term><listitem><para><indexterm><primary>environment variables</primary><secondary>overriding proxy servers and ports</secondary></indexterm><indexterm><primary>variables</primary><secondary>for proxy servers and ports</secondary></indexterm>These options
specify a proxy server and a proxy port, respectively. If present, the proxies
override any environment variables that specify proxy servers and proxy ports,
such as <literal>HTTPPROXY</literal>, <literal>HTTPPROXYPORT</literal>, <literal>SOCKS5_PORT</literal>, <literal>SOCKS5_SERVER</literal>, and <literal>http_proxy</literal>.
The <literal>http_proxy</literal> variable specifies a URL. If the options
are not used, then the relevant environment variables must be set. For more
information, see the <olink targetdoc="group-refman" targetptr="ssh-socks5-proxy-connect-1" remap="external"><citerefentry><refentrytitle>ssh-socks5-proxy-connect</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="ssh-http-proxy-connect-1" remap="external"><citerefentry><refentrytitle>ssh-http-proxy-connect</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>outside-host</replaceable></term><listitem><para>Designates a specific host to connect to. Use the <literal>%h</literal> substitution
argument to specify the host on the command line.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>outside-port</replaceable></term><listitem><para>Designates a specific port to connect to. Use the <literal>%p</literal> substitution
argument to specify the port on the command line. By specifying <literal>%h</literal> and <literal>%p</literal> without using the <literal>Host</literal> <replaceable>outside-host</replaceable> option,
the proxy command is applied to the host argument whenever the <command>ssh</command> command
is invoked.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>Run Solaris Secure Shell, specifying the outside host.</para><para>For example,
type the following:</para><screen>myLocalHost% <userinput>ssh myOutsideHost</userinput></screen><para>This command looks for a proxy command specification for <literal>myOutsideHost</literal> in your personal configuration file. If the specification is not
found, then the command looks in the system-wide configuration file, <filename>/etc/ssh/ssh_config</filename>. The proxy command is substituted for the <command>ssh</command> command.</para>
</step>
</procedure><example id="sshuser-52"><title>Connecting to Hosts Outside a Firewall From the Command Line</title><indexterm><primary>Solaris Secure Shell</primary><secondary>connecting outside firewall</secondary><tertiary>from command line</tertiary>
</indexterm><indexterm><primary><command>ssh</command> command</primary><secondary>using a proxy command</secondary>
</indexterm><indexterm><primary>firewall systems</primary><secondary>outside connections with Solaris Secure Shell</secondary><tertiary>from command line</tertiary>
</indexterm><indexterm><primary>firewall systems</primary><secondary>connecting from outside</secondary>
</indexterm><para><olink targetptr="sshuser-46" remap="internal">How to Set Up Default Connections to Hosts
Outside a Firewall</olink> explains how to specify a proxy command in a configuration
file. In this example, a proxy command is specified on the <command>ssh</command> command
line.</para><screen>% <userinput>ssh -o'Proxycommand=/usr/lib/ssh/ssh-http-proxy-connect \</userinput>
<userinput>-h myProxyServer -p 8080 myOutsideHost 22' myOutsideHost</userinput></screen><itemizedlist><para>The <option>o</option> option to the <command>ssh</command> command
provides a command-line method of specifying a proxy command. This example
command does the following:</para><listitem><para>Substitutes the HTTP proxy command for <command>ssh</command></para>
</listitem><listitem><para>Uses port <literal>8080</literal> and <literal>myProxyServer</literal> as
the proxy server</para>
</listitem><listitem><para>Connects to port <literal>22</literal> on <literal>myOutsideHost</literal></para>
</listitem>
</itemizedlist>
</example>
</task>
</sect1>
</chapter><?Pub *0000069643 0?>