SSH Client Alternatives
Total Page:16
File Type:pdf, Size:1020Kb
APPENDIX A ■ ■ ■ SSH Client Alternatives The core material of this book is focused on UNIX/Linux-based OpenSSH systems. This involves typing instructions at the command-line prompt to perform an SSH connection. However, sometimes a graphical client offers an ideal alternative to the command-line client because it requires a lower learning curve for end users. Additionally, graphical clients can allow a Microsoft Windows operating system to connect to a UNIX or Linux machine via SSH without involving a command-line interface. Using the OpenSSH client, the client options are configured through the system-wide ssh_config file and the individual user’s $HOME/.ssh/config file. When using graphical clients, the options are managed from within each tool. The configuration options presented by the graphical tools are equivalent to the settings found in an ssh_config file because they attempt to comply with the SSH protocol as a whole. Also note that several clients other than what are covered in this appendix are available. PuTTY Family The PuTTY set of SSH client utilities is primarily used on the Microsoft Windows platform, although it is also available for UNIX systems. You can download and use it for free download from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. The PuTTY set of tools includes PuTTY for terminal emulation, plink for command-line connectivity, PuTTYgen for key generation and management, Pageant for use as a graphical ssh-agent, PSCP for use as a command-line SCP utility, and PSFTP for use as an SFTP command-line client. PuTTY PuTTY is a free connectivity tool used for terminal emulation. PuTTY can be used for SSH connections, supports protocols 1 and 2, and also can connect to machines via rsh/telnet if that is desired. I commonly recommend PuTTY as an SSH client because of its price and features. PuTTY is a lightweight, yet full-featured client, weighing in at around 415KB. Although an installer is available, you can choose to also download the executable, so getting started is as simple as double-clicking the downloaded executable. 241 242 APPENDIX A ■ SSH CLIENT ALTERNATIVES The PuTTY configuration screen, shown in Figure A-1, opens when the executable is started. The more granular configuration options are controlled via the context menus on the left side of the screen. The main session information is controlled on the right side. Figure A-1. The PuTTY configuration screen Configuring PuTTY is not all that different from configuring the ssh command-line client. Most, if not all, of the options available to the ssh command-line client are found within the configuration options of PuTTY. The default configuration for PuTTY is usually adequate for most users; however, there are a few defaults you might consider changing. For instance, sometimes it is necessary to scroll back through many session lines for debugging purposes. To lengthen the history, enable 9999 lines of scrollback capabilities, as shown in Figure A-2. APPENDIX A ■ SSH CLIENT ALTERNATIVES 243 Figure A-2. Configuring PuTTY with a larger scrollback buffer Also, it is quite convenient to be able to run the terminal session in full-screen mode. If this is enabled, pressing Alt+Enter will toggle full-screen mode of a PuTTY session as shown in Figure A-3. Figure A-3. Enabling full-screen mode with PuTTY 244 APPENDIX A ■ SSH CLIENT ALTERNATIVES When working with SSH servers and firewalls that drop connections if they are idle, enabling the keep-alive feature can be useful, which is the equivalent to ServerAliveInterval in the ssh_config file. This will communicate to the server/firewall that the connection is still active. This can be configured under the Connection context menu. Figure A-4 highlights the relevant setting. Figure A-4. Enabling a keep-alive from PuTTY For security reasons, consider disabling support for SSH protocol 1. To do this, you must select 2 only, as shown in Figure A-5, from the radio button options under the Connection ➤ SSH context menu. APPENDIX A ■ SSH CLIENT ALTERNATIVES 245 Figure A-5. Ensuring only protocol 2 is allowed Enabling X11 forwarding is a common requirement. PuTTY does not provide an X-Server, so an external program must be used such as Cygwin (see Appendix B). X11 forwarding is configured by going through the Connection ➤ SSH ➤ X11 context menu, to bring up the configuration window shown in Figure A-6. The location for the X display is also configured on this screen. Figure A-6. Configuration of X11 forwarding is simple with PuTTY. 246 APPENDIX A ■ SSH CLIENT ALTERNATIVES Tunnels, automatic usernames, and color schemes can additionally be controlled within the PuTTY configuration. Once your settings are configured in the desired manner, save your ses- sion by naming it while under the Session context menu. Alternatively, you can save your session as the Default Session, which will mean all future sessions created will inherit those settings. plink plink is another tool from the maintainers of PuTTY, offering users an SSH command-line interface, something not otherwise available on the Windows platform. plink can be executed directly or from the command line. For command-line execution, navigate to the directory where plink is located and execute the command plink, which will display a set of options. Most often, plink is used to work with already created PuTTY sessions. To do this, the syntax is plink -load session_name, where session_name is the name of a session you have saved in your PuTTY configuration. For example, to connect via the Microsoft Windows command line to the server www, the command string looks like this: %>plink -load www Figure A-7 depicts a plink connection. Note that because the Windows command line does not handle terminal emulation well, any output attempting to display a control character or colors will be outputted as its ASCII values, rather than interpreted. Figure A-7. Using plink from the Microsoft Windows command line APPENDIX A ■ SSH CLIENT ALTERNATIVES 247 PuTTYgen PuTTYgen is the SSH key generator for PuTTY and its utilities. These keys can be used to connect to remote systems using key-based authentication. PuTTYgen is very similar to its command- line counterpart, ssh-keygen. PuTTYgen can generate RSA and DSA keys for a user, and also has the ability to convert keys from the OpenSSH format to the IETF (Internet Engineering Task Force) SecSH standard, which is used by SSH Communications Security. To use PuTTYgen, select your key parameters and click the Generate button, as shown in Figure A-8. The generation of the key will require some mouse movement as a source of entropy (randomness) during the generation process. This makes the key more difficult to predict. Upon completion of the generation, enter in a passphrase. PuTTYgen provides the exact text that can be pasted into an authorized_keys file to set up public key authentication, which can be seen in Figure A-9. It can also regenerate public keys from private keys, and change passphrases of private keys. Figure A-8. The default PuTTYgen screen 248 APPENDIX A ■ SSH CLIENT ALTERNATIVES Figure A-9. PuTTYgen after a key has been loaded/generated Pageant The Pageant program emulates the behavior of ssh-agent on the command line, enabling you to log in without a password and instead authenticate using a public key solution. It loads pri- vate key files that are optionally protected by a passphrase to allow PuTTY and the rest of the PuTTY utilities to make use of public key authentication. Upon starting Pageant, it will run in the system tray. To use it, double-click it, and add a private key. If the key is protected by a passphrase, you will need to enter it. Once the key is loaded in the agent, the other PuTTY utilities become aware of it. Figure A-10 shows Pageant listing the private keys loaded into it. Figure A-10. Pageant displaying the keys loaded into the agent APPENDIX A ■ SSH CLIENT ALTERNATIVES 249 Once the key is loaded, the PuTTY tools will try to authenticate using the key(s) from that agent, as shown in Figure A-11. When a PuTTY connection is attempted, all you need to do is specify the appropriate username, and authentication completes. Optionally, you can instruct PuTTY to use different keys for different saved sessions. Also, usernames can be stored inside of each session, which means that connections can be made without typing a single keystroke once Pageant is loaded. Figure A-11. Authentication in PuTTY is handled by Pageant. PSCP PSCP is a command-line utility similar to plink, capable of carrying out SCP- and SFTP-based tasks. This is ideal if transferring files to SSH Tectia Server and to OpenSSH servers. PSCP is shown in Figure A-12. PSCP can also use Pageant. PSCP is unable to be executed without sup- plying the proper arguments. Figure A-12. SCP connection from the Microsoft Windows command line 250 APPENDIX A ■ SSH CLIENT ALTERNATIVES PSFTP PSFTP is an SFTP client that can be run interactively by double-clicking the executable. At the command line, type open and then a hostname, session name from PuTTY, or an IP address. You will then be prompted for a username if your PuTTY session did not define it. Figure A-13 shows a connection established with PSFTP. Once connected, normal SFTP commands are used such as get, put, and ls. Figure A-13. PSFTP is an SFTP client for Microsoft Windows. PuTTY Summary The PuTTY family of SSH client utilities is very powerful and does not require installations nor large amounts of disk space to operate.