VOOZH about

URL: https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys?comment=22242

⇱ SSH Essentials: Working with SSH Servers, Clients, and Keys | DigitalOcean


SSH Essentials: Working with SSH Servers, Clients, and Keys

Updated on February 10, 2026
πŸ‘ SSH Essentials: Working with SSH Servers, Clients, and Keys

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

Tutorial Series: Getting Started With Cloud Computing

This curriculum introduces open-source cloud computing to a general audience along with the skills necessary to deploy applications and websites securely to the cloud.

About the author(s)

Former Senior Technical Writer at DigitalOcean, specializing in DevOps topics across multiple Linux distributions, including Ubuntu 18.04, 20.04, 22.04, as well as Debian 10 and 11.

πŸ‘ Manikandan Kurup
Manikandan Kurup
Editor
Senior Technical Content Engineer I
See author profile

With over 6 years of experience in tech publishing, Mani has edited and published more than 75 books covering a wide range of data science topics. Known for his strong attention to detail and technical knowledge, Mani specializes in creating clear, concise, and easy-to-understand content tailored for developers.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Nice tut…really helpful

The article says:

You can also use wildcards to match more than one host. Keep in mind that later matches can override earlier ones. Because of this, you should put your most general matches at the top.

But from the ssh_config(5) man page:

For each parameter, the first obtained value will be used. … Since the first obtained value for each parameter is used, more host-specific declarations should be given near the beginning of the file, and general defaults at the end.

So it should be the opposite :-)

I always forget how to use the tools provided to put my SSH key on the intended server, so I just end up manually creating the file using vim and then pasting it into the editor.

When this happen, I always forget to set the correct permissions on the ~/.ssh/ directory and the ~/.ssh/authorized_keys file on the server.

~/.ssh/ should be 700 (dwrx------) and ~/.ssh/authorized_keys should be 600 (-wr-------)

Your sshd service may refuse to use the SSH keys if their permissions are not set correctly, which forces you to set them so that your authentication is secure.

Also, and I may be wrong about this, but if you are using OS X, and your SSH private key file has the wrong permissions or is not placed inside an appropriately permissioned directory, OS X may refuse to use your private key. (I remember having this as having happened to me in the past, but I just tried to dupicate it on OS X Yosemite and it never failed on me)

One more point to make regarding permissions is user:group association. If you are making a SSH pub/priv key pair for another user, and you are doing so using root (or anything other than that users id), then you could have problems with SSH being able to use those keys for authentication. Just do a chown user:group ssh_private_key_file to set those correctly (for example: chown beau:beau ~/.ssh/id_rsa ).

Of course if you use ssh-keygen to create the SSH pub/priv key pairs and ssh-copy-id to transfer it to your server, those permissions are already set.

If you are on OS X, which doesn’t include ssh-copy-id, you should look into getting the Homebrew package manager, and use that to get a copy of ssh-copy-id.

Thanks, clear and very useful information.

wonderful article. Thanks.

An omission in this article cost me many hours. Mac users need an extra command in order to use ssh keys after generating them to a file other than the default. Mac OS X users, you need ssh-add -K <private key file name> More information found here : mac instructions

Very well written article. Very informative.

πŸ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow β€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Β© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.