Go to main content

Managing Secure Shell Access in Oracle® Solaris 11.3

Exit Print View

Updated: October 2019

Typical Secure Shell Sessions

The Secure Shell daemon (sshd) is normally started at boot time when network services are started. The daemon listens for connections from clients. A Secure Shell session begins when the user runs an ssh, scp, or sftp command. A new sshd daemon is forked for each incoming connection. The forked daemons handle key exchange, encryption, authentication, command execution, and data exchange with the client. These session characteristics are determined by client-side configuration files and server-side configuration files. Command-line arguments can override the settings in the configuration files.

The client and server must authenticate themselves to each other. After successful authentication, the user can execute commands remotely and copy data between systems.

Session Characteristics in Secure Shell

The Secure Shell server-side behavior of the sshd daemon is controlled by keyword settings in the /etc/ssh/sshd_config file. For example, the sshd_config file controls which types of authentication are permitted for accessing the server. The server-side behavior can also be controlled by the command-line options when the sshd daemon is started.

    The behavior on the client side is controlled by Secure Shell keywords in this order of precedence:

  • Command-line options

  • User's configuration file, ~/.ssh/config

  • System-wide configuration file, /etc/ssh/ssh_config

For example, a user can override a system-wide configuration Ciphers setting that prefers aes128-ctr by specifying –c aes256-ctr,aes128-ctr on the command line. The first cipher, aes256-ctr, is now preferred.

$ ssh -c aes256-ctr,aes128-ctr,arcfour

The first cipher, aes256-ctr, is now preferred.

Authentication and Key Exchange in Secure Shell

The Secure Shell protocol supports client user/host authentication and server host authentication. Cryptographic keys are exchanged for the protection of Secure Shell sessions. Secure Shell provides various methods for authentication and key exchange. Some methods are optional. Client authentication mechanisms are listed in Figure 1, Table 1, Authentication Methods for Secure Shell. Servers are authenticated by using known host public keys.

For authentication, Secure Shell supports user authentication and generic interactive authentication, which usually involves passwords. Secure Shell also supports authentication with user public keys and with trusted-host public keys. The keys can be RSA or DSA. Additionally, Secure Shell can use GSS credentials for authentication.

Acquiring GSS Credentials in Secure Shell

To use GSS-API authentication in Secure Shell, the server must have GSS-API acceptor credentials and the client must have GSS-API initiator credentials. Support is available for mech_krb5.

For mech_krb5, the server has GSS-API acceptor credentials when the host principal that corresponds to the server has a valid entry in /etc/krb5/krb5.keytab.

    The client has initiator credentials for mech_krb5 if one of the following has been done:

  • The kinit command has been run.

  • The pam_krb5 module is used in the pam.conf file.

For information about GSS-API and Kerberos, see How to Set Up a Secure NFS Environment With Multiple Kerberos Security Modes in Managing Kerberos and Other Authentication Services in Oracle Solaris 11.3. For more information about mechanisms, see the mech(4) and mech_spnego(5) man pages.

Command Execution and Data Forwarding in Secure Shell

After authentication is complete, the user can use Secure Shell, generally by requesting a shell or executing a command. Through the ssh command options, the user can make requests. Requests can include allocating a pseudo-TTY, forwarding X11 connections or TCP/IP connections, or enabling an ssh-agent authentication program over a secure connection.

    The basic components of a user session are as follows:

  1. The user requests a shell or the execution of a command, which begins the session mode.

    In this mode, data is sent or received through the terminal on the client side. On the server side, data is sent through the shell or a command.

  2. When data transfer is complete, the user program terminates.

  3. All X11 forwarding and TCP/IP forwarding is stopped, except for those connections that already exist. Existing X11 connections and TCP/IP connections remain open.

  4. The server sends an exit status message to the client. When all connections are closed, such as forwarded ports that had remained open, the client closes the connection to the server. Then, the client exits.