ARTIFACTORY: How to connect JFrog CLI using ssh key
IntroductionSetting up SSH server authentication for Artifactory is a pivotal step in ensuring secure and efficient communication between your JFrog CLI and Artifactory. This guide will walk you through the process, providing clear steps to Configure SSH Server Authentication , connect the JFrog CLI using an SSH key, and test the connection for a seamless user experience.
Connect the JFrog CLI using ssh key
2. Generate an SSH Key: Begin by generating an SSH key specific to the user who will be accessing Artifactory. Open a terminal and navigate to the ~/.ssh folder. Use the following command, replacing <ARTIFACTORY_USERNAME> with your actual username and <ARTIFACTORY_URL> with the Artifactory URL:
ssh-keygen -t rsa -C "<ARTIFACTORY_USERNAME>@<ARTIFACTORY_URL>"This command creates a new SSH key pair, consisting of a public and a private key, within the ~/.ssh directory.
3. Update Public Key in User Profile: With the SSH key pair generated, navigate to your Artifactory User Profile and update the public key. This step allows Artifactory to authenticate your SSH connections.
4. Establish Connection with JFrog CLI: To connect the JFrog CLI to Artifactory using SSH, execute the following command:
jf c add
Ensure that you specify the JFrog platform as "ssh://<ARTIFACTORY_URL>:<PORT_OPEN>". Additionally, the SSH key file path should point to the private key, for example, "/Users/.ssh/id_rsa".
5. Testing the Connection: To verify that the connection has been established successfully, you can increase the log level of the CLI to debug mode using the following command:
export JFROG_CLI_LOG_LEVEL=DEBUGNext, run the following command to ping Artifactory:
jf rt pingA successful connection will be indicated by the following log entry: [Debug] SSH authentication successful.