SSH to GoDaddy

November 15th, 2011 (Happy 10 yr anniversary xbox)

GoDaddy web hosting offers SSH access, but it is not enabled by default. These are the steps needed to enable and configure SSH. I’m assuming that if you are reading this, you already know what SSH is and why you want it. If not, here is the wiki: http://en.wikipedia.org/wiki/Secure_Shell and it is a secure alternative to FTP. I use it with unison to synchronize my files.

GoDaddy
  • All plans now include SSH. I personally have a Deluxe package ($5.99/mo.) because it allows you to host multiple domains. If you are signing up for a new account, search the web for coupons (they always have deals) and get good cashback at fatwallet.com. You can also save by committing to a longer term contract, but you should be sure that their services suite your needs first.
  • Once you have a hosting package, open the control panel by clicking My Account. Scroll down to My Products and click Web Hosting. It should show your hosting account with a Launch button on the right to access the control panel.
  • From the hosting dashboard, click Settings. Next click SSH. It takes up to 10 minutes for the request to be processed. (I’m guessing that they do it by hand, or maybe that is just what they want you to think…)
SSH Client
  • You need a client to connect to your web server. If you are using linux, ssh is usually installed by default. On Windows, putty is a nice little program and doesn’t require installation.
  • Linux: $ ssh username@domain.com
  • Note: your username and password are the same ones that you use for FTP
  • Windows (putty): Host Name: domain.com, Port: 22
  • You will get an alert about the host key not being stored in your cache. You should choose yes to connect.
  • You now have shell access to your webserver.
Notes
  • It is possible to browse the server and see how many other people have shared hosting accounts in your cluster.
  • From your home directory (~), type: cd ..
  • Type ls and you will see about 100 other hosting accounts. (mine has 110).
  • Type dirs to see where what two digit folder your files are in. You can determine which of the 100 folders your home directory is through trial an error or from the Hosting Dashboard on the GoDaddy website, under Absolute Hosting Path (you need to hover your mouse over /home/content).
  • cd .. and ls again and there are another 100+ directories.
  • From what I can tell, your account is on one of many clustered servers, so all 10,000 accounts won’t be running from a single machine. Their 4GH platform is supposed to automatically load balance.
  • I don’t know how many of these cluster’s they have, but I have 2 different accounts and they are each on a different one, because the two digit directory of one does not contain the same directory as the others.
  • Note: Access control will prevent you from viewing the content in those other directories.

Webserver Synchronization and Code Storage

Learn how to setup file synchronization to automate deploying updates to your website. This project uses several programs that are all open source and free to use. It also uses a mix of Windows and Linux (Ubuntu). It requires having SSH access to your webserver.

Technologies / Programs used:
Subversion (SVN) is used to store and organize your code. It is typically used in a team environment, but I find it just as useful for a sole developer. This guide is written using version 1.7.
SVN Server
SVN Client
  • Tortoise SVN (windows): Check out and commit files and folders directly from windows explorer.
  • Subclipse: Integrated SVN control with Eclipse.
Editor
  • Eclipse PDT: PHP development variant of Eclipse. Good for large projects.
  • Notepad++ (windows). Good for editing a few files at a time.
  • Emacs (linux, cygwin). Good for quick edits.
Linux Environment
  • Ubuntu: Easy to use linux distribution based on Debian
  • Cygwin: Linux environment that runs on windows.
Linux Programs
  • rsync: (Ubuntu: apt-get install rsync) (Cygwin: in setup.exe it is located under Net)
  • *rsync needs to be installed on the remote machine, in my case it is not :-(
  • OpenSSH: (Ubuntu: agt-get install ssh) (Cygwin: in setup.exe it is located under Net)
  • *OpenSSH is nice to access the remote server, but it is not needed for this project.
  • unison: Can synchronize files mounted to the local file system with SSHFS
  • SSHFS: Mounts an SSH directory to your local file system for synchronization with unison. (not available in Cygwin)

 

(work in progress)

Step 1: Install Editor

Step 2: Install SVN

Step 3: Setup SSH on your webserver

Step 4: Setup unison

Step 5: Automate with scripts

Linux

mount ssh script:

#! /bin/bash

sshfs username@domain.com:/directory/ /home/mike/ssh

unison to synchronize:

#! /bin/bash

svnPath=”http://festatools.svn.sourceforge.net/svnroot/festatools/FestaTools/”

localPath=”/home/mike/svnExport/gametraderworld/FestaTools/”

remotePath=”/home/mike/ssh/gametraderworld/FestaTools/”

svn export $svnPath $localPath –force -q

unison $localPath $remotePath -prefer $localPath -batch -maxthreads 2

Unmount filesystem:

#! /bin/bash

fusermount -u /home/mike/ssh

 

(work in progress)