• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero Blog

NameHero Blog

Web Hosting Tips & Resources From NameHero

  • Hosting
    • Web Hosting
    • VPS Hosting
    • WordPress Hosting
    • WooCommerce Hosting
  • Reseller
  • Enterprise
  • Domains
  • Account
  • Blog Home
  • Categories

How To Add A Public Key To Your Server Without SSH

Bhagwad Park

Published on: November 10, 2021

Categories: Website Security 0

I recently migrated to a new VPS server and needed to import a public key for my backup service so that I wouldn’t have to hand out a username/password combination. It had been a while since I’d used SSH for anything and didn’t feel like taking the time to learn everything from scratch again, so I figured I’d just import the keys using the file manager instead. After some trial and error, I finally figured out how to do it without SSH. Here are the steps!

Why You Might Need to Import a Public Key

In my case, I wanted to give my backup service – DropMySite – SSH access to the server so that they could go in and take daily backups. Now obviously I don’t want to give DropMySite my username/password. I could create a new SSH user with the appropriate permissions and let DropMySite log in with a username and password, but that would involve a lot of hassle. I would prefer to keep things simple.

Luckily, DropMySite has a public SSH key that they make freely available to everyone. I just need to import this into my server in a specific location. And when DropMySite tries to connect, my server will allow them to enter without a password because it can see that their public key is installed. Very useful!

Let’s get to it.

Step 1: Find out What Your User’s “Home” Directory is

For me, this was the biggest sticking point, and I didn’t understand why it wasn’t working. I was using the wrong home directory! Every user has a distinct “home” directory path, and you need to know what it is. Often, it’s “/home/[username]”. For root, it’s just “/”. This tutorial is about not using SSH, but if you were to use SSH, you could just type:

echo $HOME

And you’ll find out what your home directory is.

One way to know your home directory is to log into your dashboard’s file manager. By default, it should drop you into your “home” directory. So you can just start working from there.

Step 2: Change the Preferences to Allow you to See Hidden Files

By default, both cPanel and InterWorx file managers don’t allow you to see hidden files and folders starting with a “.”. So first go into your file manager preferences and turn on the option allowing you to see hidden files and directories.

Step 3: Create the “.ssh” Folder in the “Home” Directory with the Right Permissions

You should be in your “home” directory by default (hopefully). So create a new folder called “.ssh” – making sure to include the dot (.). Now use the file manager interface to assign it the following permissions:

0700

If you can’t find the option to change the directory permissions, look to the right-hand side. You might see a series of letters. Clicking that will allow you to input the appropriate permissions as shown in this screenshot:

Create the .ssh Directory in the Home Folder
Create the .ssh Directory in the Home Folder

Now that you’ve created the .ssh directory, let’s create a file inside it.

Step 4: Create the “authorized_keys” File Inside the “.ssh” Directory with 0600 Permissions

Next, enter the .ssh folder you just created, and make a new, blank file called “authorized_keys”. Ensure that it has the file permissions of:

0600

As shown here:

Create the authorized_keys File inside the .ssh Folder
Create the authorized_keys File inside the .ssh Folder

Once done, it’s time for the final step.

Step 5: Paste the Public Key into authorized_keys

Now open the “authorized_keys” file that you just created in the text editor that your file manager provides. Open the public key file in your possession and copy everything in it. Then paste it all into a single line in the “authorized_keys” file.

Save your changes, and you’re done.

Congratulations! You’ve successfully managed to import an SSH public key file without using SSH. It’s not something many people do. But if you’re not ready to deal with the terminal just yet, this is an easy way to accomplish the same thing.

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!

Most Popular Posts

Speed up your site: solving the WordPress slowdown

NameHero’s Recommended WordPress Plugin and Theme Setup (2023)

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • Website Performance
  • Web Hosting
  • Resellers
  • Website Development
  • Website Security
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • Domains
Help & Support
  • NameHero Blog
  • Knowledgebase
  • Announcements
  • Affiliates
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2023 NameHero, LLC. All rights reserved.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA