SSH Into GoDaddy cPanel Hosting

0
622
SSH Hero

There may come a time when you need to perform more advanced management on your cPanel hosting account. Most of the time these advanced commands leverage the power of SSH or secure shell. Today I’ll walk you through getting connected and show you just how powerful it can be.

What Is SSH?

First things first, what the heck is SSH? Well, a very high level overview is this, SSH allows you to make an encrypted connection to your server and deliver commands. Everything is done via command line, and I know that can be a little intimidating, but everything we’re going to be doing is safe to perform.

To get started we need some software. The most popular app for windows users is called PuTTY and can be downloaded here. Download either the 32 or 64 bit package and proceed with installation. If you aren’t sure which version to get, go ahead and grab the 32bit version.

PuTTY
PuTTY download options as of this writing

For Mac users, you already have an awesome tool installed called Terminal. You can find it under Applications and then Utilities. You can use other tools but I’m using Terminal for this walk through.

Terminal
Terminal is in Applications > Utilities

Enable SSH

On the cPanel management area, type “ssh” into the search bar at the top. This will filter your options and make it easier to see. Select “SSH Access” and you’ll get a pop up, then click on the button “Enable SSH”. It’s now enabled, ignore the next page it takes you to for now.

Enabling SSH
Enabling SSH on cPanel is as easy as clicking that button

Get Connected

With your program of choice open, go ahead and input your connection information. For cPanel and most other servers we need the following:

  • Host (server IP)
  • cPanel (or FTP) username
  • Password
  • FTP Username with domain (Terminal users only)

PuTTY

For PuTTY users, you’ll put the server IP in for Host, 22 for the port number, and then click “open” at the bottom right. It will prompt you for the username, which is the same as your cPanel username. Next it will ask for the password to the account and that’s it, you’re connected!

Terminal

With Terminal open, enter the following command replacing “username” with your FTP username and “yourdomain” with your actual domain name:

ssh username@yourdomain.com

You’ll be prompted to enter your password, then just as easy as that, you’re connected! If you have issues connecting with either program, test your credentials against an FTP client. If you can’t get connected there then it’s usually a username or password issue, otherwise I would recommend calling support.

All The Power!

Now that you’ve successfully made a connection, let’s take a test drive of your newfound power. One popular command to run for cPanel shared hosting is to find out what is hoggin’ up your file limit. Shared hosting accounts only allow 250,000 total files and it can be a pain to find what folder is the most offending. Well, not with the power of SSH at your disposal!

Run the following command, it will search your directories and output the name and total file count for each one. Simple copy the code below and right click into the SSH window to paste.

find * -maxdepth 0 -type d -exec sh -c "echo -n {} ' ' ; ls -lR {} | wc -l" \;

ssh
The results from running the command from my root directory

Dive Deeper

As you can see from my results above, public_html has the most files, which is completely fine since that directory holds all the files pertaining to your website(s). You can also run the command to change directory like I did, and then run the same search command again to get a deeper dive. Pressing on the up arrow on your keyboard will cycle through the most recently used commands.

That’s just an extremely small taste of what you can do with SSH, however, with great power comes great responsibility (yeah, I went there). Only run commands that either you understand or are well documented to do what they say they will. SSH will absolutely let you delete everything on your server without asking “are you sure?”, so use care and common sense.

*note* If you use cPanel email, your “mail” folder will probably be crazy full with emails from your inbox, outbox, SPAM, and trash folders. If everything else seems fine, double check that directory by simply browsing to it and running the same command.

cd mail
find * -maxdepth 0 -type d -exec sh -c "echo -n {} ' ' ; ls -lR {} | wc -l" \;

Questions? Leave a comment.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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