Articles on: Configuring, Customizing & Troubleshooting

How To Connect To Your Website Via SSH And SFTP (Mac)

I keep seeing this issue come up inside the helpdesk (as well as on Stack Overflow), so I thought I'd save us all sometime by doing a guide on how to connect to your NameHero hosting account via SSH and SFTP.

First, it's important to note that SSH/SFTP is disabled on all Web Hosting and Reseller Hosting accounts by default.

If you want access, you need to open a new support ticket to ask our team to enable it for you. Please provide them with the cPanel username you wish to set it up on.

We do this for security, to validate you only have good intentions in mind.

Once it's enabled by our support team, you can follow the guide to connect.

The tutorial below is for Mac. See How to SFTP/SSH with WindowsPC.



Generate Your Public Key



When connecting to SSH or SFTP at NameHero _password authentication is disabled_.

_This means you must add your public SSH key inside of cPanel and authorize it to connect._

To get started, you first need to have a key generated on your computer.

To see if you already have an SSH key setup (on a Mac) go to Utilities -> Terminateand type:

cd ~/.ssh


And then:

ls -l


If you see a file called id_rsa.pub then you already have a key, you just need to copy it to your clipboard:

pbcopy < id_rsa.pub


If you don’t, you can easily generate one with the following command in your Mac terminal:

ssh-keygen -t rsa -C "[email protected]"


Using your email address allows you to easily be able to identify the SSH key.

If you're using a Windows machine, you may find this easier using PuTTY to generate the key.

Add Your Public Key To cPanel



Once you have your public key on your clipboard, you need to go to cPanel -> SSH Access:

Then click on Manage SSH Keys:



You then want to Import Key:



You'll notice they also have a section to Generate a New Key, but I personally rather generate those on my computer so it stores everything in the correct place (see above).

Next, you just need to paste your public key in the selected box:



As long as you're using a public key, you don't have to worry about the other text fields.

I suppose you could put a name for the key if you plan on having multiple if it's not already contained in your public key file.

Once your key has been imported, you then need to go back and authorize it by clicking on Manage:



On the next screen you'll be able to Authorize it:



Congratulations! At this point your public SSH key has been added to your cPanel account and you're ready to connect via SSH or SFTP.

Connect To SSH



If you're using a Windows machine, you may wish to use the PuTTY SSH client.

If you're using a Mac (like me) I recommend using a new Terminal window which is found inside the Utilities folder:



To connect, you'll need:

Server Hostname: node201.namehero.net (please note this depends on what server your account is on)

Port: 37980

Username: Your cPanel username

You will not need your password.

To connect via the Mac terminal you would type something like this:

ssh -p 37980 [email protected]


Congratulations, you're now ready to use SSH.

Now please note, if you don't have experience with SSH, you probably shouldn't be in here. You can seriously mess up some stuff if you're not careful! So please keep this in mind!

Connect To SFTP



SFTP is a secure file transfer program that you can use in place of FTP to ensure the safest connection.

If you don't have an FTP client, I recommend downloading Filezilla as it's a good free one.

Once you have it downloaded, you'll need to set it up to use your private key you setup in the first step.

To do this, open Filezilla and click on Filezilla -> Settings -> SFTP (using a Mac):



You can then click on the Add key file... button.

Then, hold down Shift+Command+G and type in ~/.ssh



You will then be inside the folder that contains your private key and you can click on it and click Open:



Congratulations, you've added your SSH key to Filezilla.

To setup an SFTP connect, open up your site manager and use the settings noted above (in SSH).

You'll notice once you select Logon Type: Key file it will get rid of the password option and will use the SSH key.

You'll also want to make sure your Host is the correct server name and the port is 37980.

That's it! You can now connect and begin using SFTP to upload/download your website files.

How To Setup SSH And SFTP At NameHero



I've filmed a video tutorial if you'd like to follow along these steps with me using my Mac:



Feel free to let me know if you have any questions or run into problems!

Updated on: 11/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!