Usha Guduri

SSH Access to the Hosting server

This section depends more on what style you are comfortable with: point-and-click or the get-dirty-with-the-command-line. I belong to the 2nd class and feel so lost without access to the bare bone shell (which I immediately customize with aliases/shell functions/shortcuts etc). This can be a discussion in its own right.

So anyway, once you have acquired hosting space, the seller gives you an IP address of a physical machine where you can ‘setup your html files’. Depending on the seller(HostGator), you may have to ‘Enable SSH Access’ to open the ssh port.

Then you can type

1
$ ssh -p 1234 username@123.456.78.9

from the shell and voila! you are at the all too familiar bash prompt on the hosting server!

But notice that you had to enter your crazy-incomprehensible password,that you most likely copy-paste’d from the email. If you plan on spending any significant time on this box, you will get in and out of it and will be forced to enter the password each time - SSH keys coming to the rescue! I generally use RSA for my keys from my own desktop/laptop.

1
$ ssh-keygen -t rsa

will generate the necessary public/private keys in your .ssh directory.

You then create a .ssh directory on the new machine and add the id_rsa.pub key to a new authorized_keys file on the server. At the end, here is how the file setup looks like —> note the permissions: 700 for the .ssh directory and 644 for the authorized_keys file

1
2
drwx———  2 username groupname 4096 Sep 30 17:26 ./
-rw-r—r—  1 username groupname  752 Sep 30 17:26 authorized_keys

And the next time you ssh to the host, you dont have to go searching for the password in your email anymore!

Comments