Step 1: Generate an SSH key pair with PuTTYgen: Open PuTTYgen. Note: PuTTYgen is a separate utility from the PuTTY SSH client. It is normally installed as part of the PuTTY package. Under Parameters, select the required key type. For example: RSA with 2048 bits or greater. Select Generate. Move the mouse within the blank area until PuTTYgen finishes generating the key. Optionally configure a key passphrase. Select Save private key and save the private key as a .ppk file. Copy the value from the public key for pasting into the OpenSSH authorized_keys file.
Notes:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA...
For example, the end of the generated public is:
dueLF1Ob6tMokQot2968= rsa-key-20260714
Remove the comment so the configured value is:
ssh-rsa AAAAB3...dueLF1Ob6tMokQot2968=
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA...dueLF1Ob6tMokQot2968="
Step 2: Configure the public key on the FortiWeb administrator.
config system admin
edit "new_admin"
set sshkey "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA..."
next
end
Note: Replace the abbreviated example key with the complete public key copied from PuTTYgen.
Then verify:
show system admin
Step 3: Configure PuTTY with the private key.
In PuTTY, navigate to: Connection -> SSH -> Auth -> Credentials. Then:
Select Browse. Select the saved .ppk private-key file. Return to Session. Enter the FortiWeb management IP address. Confirm that the port is 22. Select SSH. Optionally save the PuTTY session.
The username can also be configured under:
Connection -> Data -> Auto-login username
Step 4: Test the SSH connection. Open the saved PuTTY session.
Expected behaviour:
log in as: new_admin
Authenticating with public key ...
Notes:
PuTTY should indicate that public-key authentication is being used. The exact message may vary by PuTTY version. If the private key was protected with a passphrase, PuTTY prompts for the private-key passphrase. This is not the FortiWeb administrator password.
Step 5: Troubleshooting. A public-key configuration issue may result in an error similar to:
Invalid SSH public key
Verify the following: The key starts with a supported identifier, such as ssh-rsa. ssh-rsa was not mistyped as sh-rsa. The public key was copied from the correct PuTTYgen field. The complete key is on one line. The optional trailing comment was removed. The CLI value is enclosed in double quotation marks. The PuTTY private key matches the FortiWeb public key. SSH administrative access is enabled on the relevant interface. Trusted hosts permit the client IP. The administrator account is allowed to use SSH.
Related documents: PuTTY User Manual – Chapter 8: Using public keys for SSH authentication FortiWeb Administration Guide: Administrator accounts. FortiWeb CLI Reference: system admin. |