Procedure for Creating Transparent SSH Logins

Abstract


Title: Procedure for Creating Transparent SSH Logins
Author: pdwilso@gmail.com
Version: 0.9
Date: 2009.03.12
Document Number: CPS-20090312

Preconditions

For this example, we will use the following names:


Local Workstation Username: luid
Local Workstation Hostname: lhost
Remote Host Username: ruid
Remote Host Hostname: rhost

The password tokens will be:

Local Workstation Key-Pair Passphrase: lwkpp Remote Host User Account Password: rhuap

Be sure to substitute the real usernames, hostnames, and passwords when performing this procedure.

Instcuctions

  1. At a command prompt in the $HOME directory of the user account on the local workstation, use the 'ssh–keygen' command to generate a key pair: 
    ssh–keygen –t dsa –b 2048 –f ~/.ssh/id_dsa
  2. Enter a [new] passphrase for the newly generated key. In this example, we use 'lwkpp' - in practice, a longer, more secure passphrase should be used. Note that, for SSH passphrases, all characters and punctuation are valid characters, so passphrases can be human language readable/recallable.

Note 1:  The ~/.ssh Directory

Typically any user account that uses OpenSSH to connect to other hosts will have a hidden directory called .ssh in the user's $HOME directory. The permissions on this hidden directory must be correctly set in order for SSH to function correctly. The only acceptable permission set for .ssh is 0700 – that is:  owner read/write/execute permissions only. Note that the files in the directory should be set to 0600, since the eXecute bit only needs to be set on the directory. If their are sub–directories under .ssh, those, too, will need the execute bit set (0700).

Either of the ssh commands – ssh or ssh–keygen – should craete the .ssh directory when run for the first time on the user’s account.

Otherwise, use the 'mkdir' command to make diretories, and the 'chmod' command to change permissions. See the system man pages for more about those commands [I.E. use the commands 'man mkdir' and 'man chmod'].


Note 2: The ssh–copy–id Script

Below — between the cut lines — is the source code of the 'ssh–copy–id' script provided by the OpenSSH package available for OpenSuSE. This script should work on most *nix systems where SSH is installed, and may work for Cygwin installs, as well. The instructions explain how to install the script.

Installation Instructions

  1. Using a text editor, copy and paste (or otherwise load) the source code from between the cut lines [below] into a new file.
  2. Save the file as ssh–copy–id
  3. Mark the newly saved file as executable;
    chmod +x ssh–copy–id
  4. Place the executable file in the users' path
    sudo cp ssh–copy–id /usr/local/bin/

    or

    sudo cp ssh–copy–id /usr/bin/

    or even

    sudo cp ssh–copy–id ~/bin/

    if you don't have sudo privileges.

Usage

Use of the ssh–copy–id script is straight–forward: 

Preconditions