Connect the JFrog CLI using ssh key

ARTIFACTORY: How to connect JFrog CLI using ssh key

AuthorFullName__c
Nathan Amiel
articleNumber
000005871
ft:sourceType
Salesforce
FirstPublishedDate
2023-09-13T11:53:47Z
lastModifiedDate
2023-09-13
VersionNumber
3
1. Configure SSH Server Authentication

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.

User-added image

4. Establish Connection with JFrog CLI: To connect the JFrog CLI to Artifactory using SSH, execute the following command:
jf c add	

User-added image
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=DEBUG
Next, run the following command to ping Artifactory:
jf rt ping
A successful connection will be indicated by the following log entry: [Debug] SSH authentication successful.

User-added image