SHARE
Facebook X Pinterest WhatsApp

Tip of the Trade: OpenSSH Speed Tips and Tricks

Written By
thumbnail Carla Schroder
Carla Schroder
Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



Although using public key authentication instead of passwords is a great method for increasing the security of SSH transfers, transferring SSH identity keys can be a royal pain. First, you create your key pairs; then, you copy the public key into the correct locations on all the machines you want to log into. The keys must be in a particular format, and you must go into the correct directory with the correct permissions. Fortunately, ssh-copy-id, a slick utility included with OpenSSH, makes it easy.

Using public key authentication is a great way to make SSH transfers more secure. Transferring SSH identity keys can be a royal pain, however. Fortunately, ssh-copy-id, a slick utility included with OpenSSH, simplifies the process.

SSH is a secure remote administration utility with a seemingly endless variety of clever shortcuts and capabilities. For example, you can log in and execute a remote command with a single command, rather than first logging in and then typing the command:

This is a fun example that also demonstrates a little gotcha- ls ~ will list Carla’s home directory, not Terry’s. If you want to see Terry’s home directory you must specify ls /home/terry. You can do this with any one-off command, such as starting a backup script, viewing running processes or printing a document.

$ ssh-copy-id -i  id_rsa.pub terry@host2 

ssh-copy-id copies identity keys in the correct format, makes sure file permissions and ownership are correct, and ensures a private key is not accidentally copied.

Using key-based authentication instead of passwords means you don’t have to give away system passwords. To make it easier to manage multiple remote systems, you can give your keys any arbitrary names you want when you create them, like this:

$ ssh-keygen -t rsa -f id_apacheserver

When you connect, you simply name the correct key:

$ ssh -i id_apacheserver carla@host.alrac.net

Finally, don’t forget the wonderful sshfs command for mounting an entire remote filesystem. It’s much faster and easier than setting up a Samba or NFS server. First, create a local directory for the mountpoint, then fetch your remote filesystem:

$ sshfs hostname:/remotedir localdir/

Now, you can operate on the remote files as if they were local.

thumbnail Carla Schroder

Carla Schroder is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.