Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
New Contributor

remote ssh connection with key

I want to connect a linux machine via ssh. Linux server just accept key authentication.

"execute ssh" command does not have an option to use public key file.

How can i upload my ssh public key? And how can i use?



Hi ferhan,

if I got it correctly then you would like to originate connection to your server (which requires key authentication) from your FortiGate.


If so, then I'm afraid you would need to use some another jump-host then FortiGate.

FortiGate does have 'exec ssh-option'  to define some extra properties of future SSH connections originated directly from FortiGate itself, but auth key is not there, yet.


Tomas Stribrny - NASDAQ:FTNT - Fortinet Inc. - TAC Staff Engineer
AAA, MFA, VoIP and other Fortinet stuff

New Contributor

Hey farhan, as i recognized your issue is in authentication part , follow this steps to solve it :

make a key pair

First, Log in to the computer you’ll use for accessing the remote host, and use the command line SSH to generate a key pair by the RSA algorithm. To generate RSA keys, type the following on the command line, and click on enter:

ssh-keygen -t rsa

 Supply a filename and password

You will have to give a filename to save the key pair and a password to protect your private key. If you want to continue with the default filename and location for your key pair, click on Enter or Return without entering a filename. Alternatively, you can enter a filename such as My_ssh_key at the prompt and press Enter or Return. Pay attention that many remote hosts are configured to accept private keys with the default filename and path. Therefore, you must explicitly invoke this on the SSH command line or in an SSH client configuration file (~/.ssh/config).

You need to enter a password with at least five characters and click Enter or Return. If you click on Enter without a password, it will generate your private key without password protection.

Copy public key

 Use SFTP or SCP for copying the public key file to your account on the remote system.

Enter your account credentials

 Your public key will be duplicated to your home directory and kept with the same filename on the remote system.

Log in to the remote system with your account username and password

 make necessary file on your account

mkdir -p ~/.ssh
Top Kudoed Authors