Tag Archives: ssh

git Over A Non-Standard ssh Port

git speaks ssh over the standard port 22 out of the box, and flawlessly. For example:

git clone git@hostname:repository_name

There are a fair number of installations running ssh on non-standard ports, however, and the above method doesn’t directly support a port, it seem. Linux Torvald answered the the question back in 2005, and suggested editing the local ssh config file. This works beautifully where Un*x is spoken, including Mac OS X.

In the ~/.ssh/config file add an entry such as:

Host host_alias
    User git
    Port port_number
    Hostname hostname

For those poor souls in Windows land, Mauvis Ledford has a tip:

$ git clone ssh://user@host:port/repository

should work also.

Using MySQL Administrator Over a Secure (ssh) Connection

MySQL Administrator is not designed to work over a secure connection like ssh. By using ssh tunneling, you can connect to your remote MySQL servers from your workstation.

MySQL Tools

Download the MySQL Tools package.
Install the MySQL Tools package. On the Mac, just drag to Applications.

Create the Tunnel

To create the tunnel, open a shell (Terminal on the Mac) and run the following:

$ ssh -N -L3306: username@remote_hostname

-N instructs ssh to run silently without creating a remote shell.
-L a:b:c instructs ssh to use port “a” on the local machine and map it (from the remote server’s viewpoint to port c on machine b).
Now you have a secure tunnel to the server.

Use the Right Hostname

If you run on a Un*x based workstation (i.e. Mac or Linux), when you run either the MySQL Administrator or the MySQL Query Browser, set the “Server Hostname” field to “”.

MySQL Administrator connection dialog

If you skip this step you will receive the following error:
Error Dialog

How to Fix ssh Pausing When Connecting

At some locations you may find that ssh pauses somewhere around ten seconds between the connection and the login prompt. I find this happens on LANs where reverse DNS isn’t working right. (Such as when I’m playing with DNS at my office and break something. Did I admit to that? lol)

On the remote server, edit the SSH dæmon configuration file thus:

  1. $ sudo vim /etc/ssh/ssd_config
  2. Locate UseDNS.
  3. Change it to: UseDNS no
  4. Save the file and exit vim.
  5. Restart sshd. On CentOS 5:
    $ sudo /sbin/service sshd restart