Getting Connected: Choosing An SSH Client
Getting Connected: Choosing An SSH Client
Getting Connected: Choosing An SSH Client
When your account is created you will be provided with details on how to connect to the Linux
server. You may be provided with some or all of the following information:
Username. This is also known as an account, login, or ID.
Password
SSH key
Server name or IP address
Port number
Connection protocol
The connection protocol will either be SSH (Secure Shell) or telnet. SSH and telnet provide ways
to connect to a server over the Internet or a local area network. In the vast majority of cases the
connection protocol will be SSH. Telnet is practically obsolete at this point, however you may run
into it if you need to access a legacy system.
Type the host name or IP address you were given into the Host Name (or IP address) box. If no
port was given to you, leave it at the default value of 22.
Enter your username by clicking on Data in the left pane. It is located directly below Connection .
Type your username into the Auto-login username field. If you skip this step you will be
prompted for your username when you connect to the server.
Save your session by typing in a name in the Saved Sessions box and clicking Save . This allows
you to speed up this process by simply double clicking on your saved session to connect to the
Linux server.
When you click Open a connection attempt will be made. The first time you connect to a particular
server, PuTTY will ask to cache that server's host key. You will not be prompted again on
subsequent connections. To add the server's SSH host key to PuTTY's cache, simply click Yes
when prompted.
Once you are successfully logged in, you will see something similar to this:
The first time you connect to a particular server you will be asked to verify that server's host key.
You will not be prompted again on subsequent connections. When you are asked Are you sure
Like Mac, Linux also comes with a terminal program and an SSH client. Once you are connected
to one Linux server you can use the ssh command to connect to another Linux server. You can
nest multiple connections and navigate through your network of Linux servers in this fashion.
Now you can save the public and private keys for later use with PuTTY.
When you run PuTTYgen you will be asked to move the mouse around to create some random
data that will be used in the generation of the key.
You have the option to use a passphrase for your key. You can also change the comment to
something more meaningful like Bob's key .
Now, save the public and private keys buy pressing Save public key and then Save private
key . Give the public key to the system administrator so they can associate it with your account.
The private key is for your eyes only. Do not share your private key!
Next, export the key as an OpenSSH key by clicking on Conversions and then Export OpenSSH
Key . This OpenSSH key can later be used on Unix or Linux systems.
Follow the "Connecting via SSH with a Password from Windows" instructions, but this time add
one additional step to specify your SSH private key file. You can do this by by clicking on the
plug sign ( + ) next to SSH in the left pane to reveal more options. Next click on Auth . In the right
pane select Browse under the Private key file for authentication field and locate your
private SSH key.
You will gain a full understanding of what these commands do as you progress through this
book. In order to expedite the process of getting connected, the details will be saved for later.
Switch to the Finder to copy your keys into the .ssh folder. In the Finder menu click Go and then
Go to Folder... and type ~/.ssh when prompted. When you click go , the .ssh folder will be
displayed. Now you can drag your keys into place.
Back in the Terminal window, set the proper permissions on your key files. (Again, these
commands will be covered later.)
cd ~/.ssh
chmod 600 *
I highly recommend naming the keys in the following format: id_rsa and id_rsa.pub or id_dsa and
id_dsa.pub Otherwise, you will have to specify the location of your key when you use the ssh
command or perform some additional configuration to tell SSH that your keys are not named in
the standard way.
As a general rule it makes your life much easier if you follow the standard conventions and
common practices. I will point them out along the way. One of the things I love most about Linux
is the freedom and power it gives you to do things in a myriad of ways. There are cases were not
following the standard conventions will be the right thing to do.
If you still wish to name your key something else, you can tell SSH where to find it by adding -i
key_location to the ssh command. Remember, the format of the ssh command we used above
is ssh -p port_number username@servername . It can be expanded to ssh -i key_location -p
port_number username@servername . Here's an example:
ssh -i /Users/bob/.ssh/bobs_key bob@linuxsvr
Run PuTTY and select the Telnet radio button. If no port was given to you, leave it at the default
value of 23. You will be prompted for your username and password when you connect to the
server.
The built-in telnet client on Mac is a command line program. Command line programs can be run
with the Terminal application that comes with the Mac operating system. It is located in the
/Applications/Utilities folder. The format of the telnet command is telnet servername
port_number . You only need to include a port number if it is different than the default value of 23.
You will be prompted for your username and password when you connect to the server.
mac:~ bob$ telnet linuxsvr
Trying 10.0.0.7...
Connected to 10.0.0.7.
Escape character is '^]'.
Ubuntu 12.04.3 LTS
linuxsvr login: bob
Password:
Last login: Thu Nov 7 01:26:37 UTC 2013
Welcome to Ubuntu 12.04.3 LTS
* Documentation:
https://help.ubuntu.com/
Connecting Directly
If you are running Linux in VirtualBox as described in the previous chapter or you have dedicated
hardware with Linux installed on it, you can simply log in directly to the server. You will be
presented with a prompt requesting your username and password. If it is a graphical
environment, you will need to find a terminal application to use after you have logged in. In most
cases it will literally be "terminal", but you might see some slight variations like "gnome terminal",
"konsole", or "xterm."
Here is what opening the terminal application looks like in CentOS. You will find it in one of the
menus.
In some Linux graphical environments there may not be a traditional menuing system. In these
cases you will want to search for the terminal application. In this Ubuntu example, click the button
in the top left of the screen to bring up the dashboard. You can now start typing to find
applications that are installed on the system.
Deep Dive
20 Windows SSH Clients You Can Use to Connect to Your Linux Server - An article that
lists 20 of the most popular Windows SSH clients.
List of Mac SSH clients
List of SSH clients, all platforms
List of Terminal Emulators - Includes terminals for Windows, Mac, and Linux.
List of Telnet Clients
List of Windows SSH clients
OpenSSH.org - The official website for OpenSSH.
PuTTY
PuTTY Documentation
putty.exe
puttygen.exe
putty.zip - A zip file containing all of the PuTTY program files.
Watch Star Wars over a telnet connection.
telnet towel.blinkenlights.nl
To disconnect, hold down the Ctrl key and press the right bracket ( ] ). At the telnet
> prompt type quit and press Enter .
Using SSH Public Key Authentication