Remote connection with SSH

While teaching Big Data and Hadoop, a student asks me about SSH and how to use. I’ll discuss about the protocol and the tools to benefit from it.

Lately, I automate the deployment of Hadoop clusters and its core components including Kerberos and LDAP servers from a single host to a full clusters. SSH is intensively used to remotely and securely run commands and access files.

We use it to connect from a computer to a remote host, being a server or the computer of a friend. SSH establishes a secure and encrypted channel of communication. Once logged in, you can execute commands on the remote hosts. Today, most of the servers and clients rely on version 2 of the protocol. SSH is great for running commands but not only.

On top of SSH, you can use SCP and SFTP to transfer files. However, SCP uses version 1 of SSH. The older and deprecated version of SSH.

To connect to a remote host, you’ll need: its ip or domain name, the port which default to “22”, the username with which you want to log in, the username password and optionally a path where you wish to login instead of the user home directory by default.

On OSX

OSX comes with a very handy application called terminal. I use all day long with pleasure. To connect, simply type ssh {username}@{address}. If the port isn’t “22”, then add -p {port}. The first time you connect, you’ll be ask to validate the connection to this remote host, simply agree and you’ll be good to go.

To transfer files, I’ve been using Cyberduck for years know. It’s free and highly reliable.

On Windows

Not being a user of Windows, I’m constantly asked about which tools to use. Windows comes with the unusable DOS and PowerShell command. Not just unusable, it’s also nearly unusefull. To connect over SSH, Putty is widely deployed. Not userfriendly if you come from Linux or OSX, but workable.

To transfer files, I’ve been very happy with WinSCP a few years ago. Another solution is FileZilla but I found the interface non intuitive.

On Linux

As for OSX, you’ll find a great terminal application already inside your distribution. The usage is just the same.

To transfer files, the file browsers bundled in the most popular desktop environments like GNOME and KDE have SFTP client capabilities. For Konqueror (KDE) and Nautilus (GNOME), type sftp://{username}@{host}:{path} inside the location field.