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

Send config file to sftp server via vdom root failed.

I am not able to run the backup command so that the fortinet backup can upload to a sftp server. Please note, I am able to ping and connect/login to sftp server successfully when I use winscp or other tool to connect with sftp server

 

200F-HA1 # execute backup config sftp FortinetBKP%date%.cfg 10.10.40.8:822 fortinet fortinet1
Please wait...
Connect to sftp server 10.10.40.8:822 ...
Please wait...
Connect to sftp server 10.10.40.8:822 ...
Send config file to sftp server via vdom root failed.
Command fail. Return code -1

8 REPLIES 8
sharmaj
Staff
Staff

Hello

 

This needs more investigation.

 

Please run this command: diag sniffer packet any " host 10.10.40.8 and port 822" for like 10 seconds while you try again and share the output

 

Jay sharma
ZAHIDHASEEB
New Contributor III

I replaced the ftp server internal name with external name and get successful result  . Below is the example command.

execute backup config sftp FortinetBKP-%%date%%.cfg sftp.domainname.com:822 fortinet fortinet1

 

However when I use the command with time, it gets failed

execute backup config sftp FortinetBKP-%%time%%.cfg sftp.domainname.com:822 fortinet fortinet1. Actually if we schedule backup on hourly basis then the same backup file gets overwrite. I don't want to overwrite the backup file instead make a new file

AlexC-FTNT

You can find some solutions discussed here:
https://community.fortinet.com/t5/Fortinet-Forum/Automated-config-backup-with-date/m-p/73003?m=19502...
https://community.fortinet.com/t5/Fortinet-Forum/Auto-script-override/td-p/67388

FortiGate is not responsible for storing/managing these configurations. You can use FortiManager for a more complete management solution.


- Toss a 'Like' to your fixxer, oh Valley of Plenty! and chose the solution, too00oo -
ZAHIDHASEEB

cant we use simply this ->  %%time%% like below command

execute backup config sftp FortinetBKP-%%time%%.cfg sftp.domainname.com:822 username password

AlexC-FTNT

Does the command work? (do you get the timestamp in the filename?)

yes > no problem

no > not implemented (or bug, if this feature was documented somewhere). 

All you can do is ask for NFR (new feature request through your local sales representative). But this has already been requested last year (NFR 684857) and not implemented (yet).


- Toss a 'Like' to your fixxer, oh Valley of Plenty! and chose the solution, too00oo -
PraveenPoulose

Hi @ZAHIDHASEEB,

 

I hope below points will help you to address the resolution.

 

"Send config file to sftp server via vdom root failed.
Command fail. Return code -1"

 

Above error will mostly show due to SFTP server reachability, wrong credentials or permission error. 

 

Actually, why that was worked, when you tried with same cmd after replacing server name? Because previously the SFTP Internal hostname was not resolved by your FortiGate/Internal DNS server. While you have replacing with External SFTP hostname, it was resolved by public DNS server. Otherwise, your mentioned commands are fine.

 

For updating DNS domain& hostname, please use below CLI cmds,

config system dns-database

edit "domain.local"

set domain "domain.local"

set authoritative disable

config dns-entry

edit 5

set hostname "fpx222"

set ip 10.4.62.222

next

end

end

 

And you have mentioned, after used %%time%% argument file got overwrite. If the script is manually run, 'execute backup config sftp FortinetBKP-Backup%%time%%.cfg sftp.domainname.com:822 fortinet fortinet1', would be saved as by same given character on the server, and it will never update with time details. Try with triggering the Automation stitch, only then, the actual time of the FortiGate will update and old file could not overwrite.

 

For try automation stich, please use below link FYR,

https://community.fortinet.com/t5/FortiGate/Technical-Tip-How-to-send-automated-backups-of-the-confi...

ZAHIDHASEEB
New Contributor III

1- timestamp is not printing when I run the command from CLI (below result is for reference) and no backup generate when the script run from trigger

ZAHIDHASEEB_0-1647506645246.png

 

 

AlexC-FTNT

I know that %%date%% can be used, but I can't find any reference about %%time%% variable. Can you reference any document where this is presented as a "feature"?

The question is not about what works and not - it is about what is supposed to work and what not.


- Toss a 'Like' to your fixxer, oh Valley of Plenty! and chose the solution, too00oo -
Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors