Secure communications with OpenSSH

This month we take a look at a suite of tools for secure remote administration and file transfers over a network, OpenSSH. When it comes to tasks such as remote administration, the need for security and encrypted communications become obvious.

Included on this month's cover CD are the latest versions of OpenSSL and OpenSSH. The former is a library that provides the encryption features used by OpenSSH and, thus, must be installed before OpenSSH. Once installed, OpenSSH provides three main tools, each of which will be covered in this article:

- ssh, a replacement for rlogin and telnet;
- scp, a replacement for rcp; and
- sftp, a replacement for ftp.All of these tools use strong encryption and other security features to prevent network attacks such as eavesdropping and connection hijacking.

SSH

The most commonly used program in the OpenSSH suite is ssh, which allows you to access another computer through a shell prompt. The encryption provided by ssh protects against an outsider stealing the password used to access the system, among other things. ssh is now the de facto standard for remote administration because of such features.

Accessing a system using ssh is easy, provided that system has an ssh server running (this is included in the OpenSSH package). You will need a username and password on the system to access it. To use ssh to access a remote system, type in a shell:

$ ssh username@server

If this is the first time you are connecting to the server, you will be prompted with:

Host key not found from the list of known hosts.

Are you sure you want to continue connecting (yes/no)?

Typing "yes" should then present you with a password prompt. If authentication is successful, you should be able to use the system as if you were sitting at it locally.

SCP

I find this tool more useful every day. It allows you to copy files across a network remotely, without the need to use a reasonably complicated client such as FTP. As this is part of the OpenSSH suite, all of the data transmitted during the copy is encrypted to prevent people eavesdropping on the transfer. The basic syntax for scp is:

$ scp source_file user@destination:/directory/to/copy/toA number of useful options can be used with the scp command to make copying a large number of files easier. Recursive copying can copy whole directories, and compression can speed up transfers on a slow link such as a modem. To try these features, just add the options "-R" and "-C" to the scp as shown:

$ scp -RC source_directory user@destination:/directory/to/copy/toSFTP This command line file transfer program uses a set of commands similar to those of common FTP programs. Once again, all communications using sftp are encrypted. sftp is particularly useful for manipulating a number of files on a host system. The functionalities of sftp and scp often overlap, so which you decide to use is mostly up to personal preference. Using sftp follows the familiar command syntax:

$ sftp user@destination

PASSWORDLESS SSH

If you've been trying out each of the tools covered in this article, you'll be aware by now that each time you use a command you need to enter your password. While this is a good, if not essential, security feature, there are times when it is perfectly safe to allow ssh to connect between computers without requiring a password. An example of this situation would be two networked computers isolated from a potentially dangerous network such as the Internet, such as a laptop and a desktop.

Setting up passwordless ssh is very easy. You need to tell the computer you want to access without a password and who you are so it can still authenticate you. To do this, generate a public/private key pair by typing in a shell:

$ ssh-keygen

This will create the two keys and save them in '~/.ssh/'. The private key will be called 'identity' while the public key will be called 'identity.pub'. To enable passwordless ssh, copy the public key to the server you want to access. To do this, log into the server and edit the file '~/.ssh/authorized_keys', add the entire contents of the recently created 'identity.pub' file and save the changes. Now you should be able to access the server without a password.

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Essentials

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

GGG Evaluation Team

Michael Hargreaves

Windows 10 for Business / Dell XPS

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Kathy Cassidy

STYLISTIC Q702

First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni

STYLISTIC Q572

For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?