Configuring SSH public key authentication

VisualGDB 3.0 and later supports setting up public key authentication automatically. Simply check the “Setup public key autnehtication” when creating a new SSH connection and VisualGDB will do all the work for you.sshconn

If you are not using VisualGDB, feel free to use SmarTTY – our free SSH client, to setup the public key authentication with one click.

In case you want to do everything manually, follow the tutorial below:

  1. Install and start an SSH server on your Linux machine. On debian-based systems this is done by running the following command:
    sudo apt-get install openssh-server

    01-installserver

  2. Start the cygwin shell. Create the .ssh directory in your home directory and test the connection to your Linux machine::
    mkdir ~/.ssh
    ssh linuxuser@linuxmachine

    Replace linuxuser with your user name on the linux machine and replace linuxmachine with the Linux computer name or IP address.Note that you will need to enter the password. Once you complete this tutorial this will no longer be required.02-connect

  3. We will now generate a keypair: the public key that will be placed on the Linux machine and the private key that will be stored on the Windows machine. To generate the keypair, type the following command in the Cygwin shell:
    ssh-keygen -t dsa

    Confirm default answers for the ssh-keygen questions by pressing Enter:03-keygen

  4. Copy the public key to the home directory in your Linux machine by running the following command from cygwin shell:
    scp ~/.ssh/id_dsa.pub linuxuser@linuxmachine:~

    05-copy

  5. Connect to the Linux machine with ssh and append the id_dsa.pub file to the .ssh/authorized_keys file:
    ssh linuxuser@linuxmachine
    cat ~/id_dsa.pub >> ~/.ssh/authorized_keys

    06-append

  6. Now you can test the SSH authentication by running the following command from Windows machine (can be done outside cygwin shell):
    c:\cygwin\bin\ssh linuxuser@linuxmachine

    07-testIf you have done everything correctly, ssh will authenticate automatically not requiring you to enter the password.