Using SSH Keys with VS Code for IBM i

VS Code for iTo make our IBM i servers more secure, our system administrator has configured our SSH services to require public key authentication rather than password-based logins. To comply with this security policy, we also set up our Visual Studio Code for i connections to use SSH keys.

This article explains how to set up an SSH key with Code for i.

First, set up and test your SSH key

Before using your SSH key with Code for i, you should test logging in with your key from an SSH terminal (Putty, OpenSSH/Powershell for Windows, Mac Terminal, etc.). When you can successfully connect to SSH using your key in a terminal, you can proceed to setting up the key in Code for i.

To do the preliminary SSH key setup that lets you connect with a terminal, see Getting Started with SSH on IBM i. Those steps include generating your public and private keys, providing the public key (id_rsa.pub) to your IBM i administrator for placement in authorized_keys, and setting permissions.

NOTE: If you are given an option to set a passphrase, please choose no passphrase at this time, because Code for i does not yet support passphrases on SSH connections.

Upload private SSH key to Code for i

After you have confirmed that your SSH key works with your IBM i server from a terminal program, it’s time to upload your private key to Code for i.

If you are just getting started with Code for i, see our instructions on installing Code for i and creating an IBM i connection. You will type your connection settings in a panel called IBM i Login. If, however, you’ve already created a connection definition for your server, you can change it by going to the SERVERS list, right-clicking the connection name, and choosing Login Settings, which leads to a panel called Login Settings.

Whether you are creating an IBM i Login for the first time, or editing Login Settings, there is a Private Key section, as shown below. Click Choose File and upload your id_rsa file (not id_rsa.pub). Then click Save.

Code for i login panel with SSH key file upload button

Code for i login panel with SSH key file upload button

Now you should be able to connect without a password. If you are unable to connect, verify that you can still log in from a terminal program.

You’ll find additional tips on how to use Visual Studio Code for i in our Code for i Resource Guide.

For the best way to keep your entire team productive with VS Code for i, talk to us about VS Code for i SmartSupport.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.