How to Connect from Windows Using Command Line

In this tutorial, you will learn how to configure PuTTY in order to connect to different devices, including GNU/Linux servers on the Jotelulu platform.

With this tool, you will be able to establish an SSH connection to a remote server using an encrypted connection via port 22. This way, you can administrate your server remotely using command line as if you were physically at the machine.

 

How to connect from Windows to a GNU/Linux server using command line

 

Before you get started:

To successfully complete this tutorial and configure PuTTY to connect to an existing server on your Servers subscription, you will need:

  • To be registered on the platform and have logged in.
  • To have a deployed server on your Servers subscription.
  • To have internet access and know the IP addresses, usernames and passwords for the servers that you want to connect to.

Part 1 – Installing and using PuTTY

You can download the tool from the PuTTY website.

It is quite simple to install using the standard Windows installation wizard. The only thing to bear in mind is that you will need to run the installer as an administrator.

Once installed, launch the program and you will see a window like the one shown below. To make a one-off connection that won’t be saved for next time, enter the following details:

  • Host Name or IP Address (1), where you should add the machine that you want to connect to.
  • Connection Type (2), where you can select your connection method from SSH, Telnet, Serial, Raw, etc. This is normally SSH (port 22) for connections with other remote GNU/Linux systems.

Once you have filled in these fields, click on “Open” (3) to establish the connection.

Part 1 - Example configuration for a one-off connection

Part 1 – Example configuration for a one-off connection

If you wish to save the session for future use, you will need to enter the following:

  • Host Name or IP Address (4), where you should add the machine that you want to connect to.
  • Connection Type (5), where you can select your connection method from SSH, Telnet, Serial, Raw, etc. This is normally SSH (port 22) for connections with other remote GNU/Linux systems.
  • Name with which to save the session (6).

Then, click on “Save” (7).

Part 1 - Save the session

Part 1 – Save the session

From now on, you will be able to connect to the server by double-clicking on the saved session (8).

Part 2 - Configuring session logs on PuTTY

Part 2 – Configuring session logs on PuTTY

Next, we will explain how to save logs for PuTTY sessions launched on Windows devices.

NOTE: It is the same as launching a script on GNU/Linux or Sun/Solaris.

First, select an existing PuTTY session (9) and then click on Session > Logging (10).

Part 2 - Click on Session > Logging

Part 2 – Click on Session > Logging

Next, select “All session output” (11). It is very important to select this otherwise the sessions that are opened will not be saved.

Then, click on the “Browse…” button (12) and choose a folder path where your logs will be saved. It is a good idea to create a dedicated folder for all logs by all technicians and keep regular backups of this folder.

Once you have done this, give a name to your log files (13).

It is important to bear in mind that, if they are saved with the server name, the previous file will be overwritten each time you connect to the server. To resolve this, we recommend using the following format:

<User_Name >_&H_&D&M&Y-&T.log

Where:

  • &H         =           Hostname.
  • &D         =           Day.
  • &M        =           Month.
  • &Y         =           Year.
  • &T         =           Time.

Example:

jioller_&H_&D&M&Y-&T.log

Part 2 - Configuring log files

Part 2 – Configuring log files

Once you have done this, click again on “Session” (14) and save your changes by clicking on “Save” (15).

Part 2 - Save your changes

Part 2 – Save your changes

From now on, all your connections via SSH, Telnet, etc. will be logged.

 

Part 3 – Configuring PuTTY to support X11 sessions

There may be times when you wish to make a connection using a graphic console, and the X11 subsystem is basically a GNU/Linux graphic server. To use this service with PuTTY, you will need two things: the service needs to be running on the server and the local instance of PuTTY needs to have X11 session forward enabled.

To configure PuTTY to support X11 sessions, you first need to start PuTTY and select a machine (16). Then, click on “Load” (17).

Part 3 - Load a machine

Part 3 – Load a machine

In the left-hand menu, click on “Connection > SSH > X11” (18), and in the menu that appears, click on the checkbox “X11 forwarding”, “Enable X11 forwarding” (19).

Part 3 - Activate X11 forwarding

Part 3 – Activate X11 forwarding

To make these changes permanent, return to “Session” (20) and click on “Save” (21).

Part 3 - Save your changes

Part 3 – Save your changes

You can now make establish a connection using graphic sessions.

 

Conclusions and next steps:

By configuring PuTTY correctly, you can quickly connect to a wide range of devices using SSH/Telnet/Raw/Console, etc. It also allows you to automatically save your session logs. As you can see in this tutorial, it is very simple to configure PuTTY for this purpose.

We hope that you have found this tutorial useful when setting up the tool. But if you encounter any issues, please don’t hesitate to contact us so that we can help you.

Thank you for choosing Jotelulu!

Categorias:Servidores