Description |
This article describes how to generate ssh keys on the Linux SSH host and use it for public-private key authentication to the FortiGate unit. |
Scope | FortiOS 6.4, 7.0.x, 7.2.x. |
Solution |
1) Generate the public-private key pair on the Linux host.
On the Linux host, it is possible to use the 'ssh-keygen' command/tool as follow :
Public-private keys are stored under /home/admin_ro/.ssh/ , 'id_rsa' is the private key, and 'id_rsa.pub' is the public key.
Keep in mind that the private key is kept on the client's machine and should never be shared with anyone. The public key is copied to the remote server and can be freely shared.
admin_ro@LinuxPC:~ $ cd /home/admin_ro/.
2) Add the public key to the FortiGate:
Login with the super-admin account and create a new account with a username that should be the same as the one used in the Linux host for generating the ssh key pairs.
In this case, the username is 'admin_ro'.
# config system admin edit "admin_ro"
In the example above as an account profile is used 'super_admin_readonly' but it is possible to use any other profile.
first is the key-type and second is the public-key generated on the Linux host.
It is possible to use 'cat' to read and get the public key value.
3) Login to FortiGate via SSH without using a user/password, only using the generated public-private key pair:
Related Article: How to authenticate an admin user to FortiGate via CLI using SSH keys |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.