Community discussions

MikroTik App
 
TVinson
just joined
Topic Author
Posts: 1
Joined: Tue Aug 16, 2022 10:30 pm

Upload router backups via SFTP

Tue Aug 16, 2022 10:47 pm

So I've been slamming my head against a wall over this one. Long story short I had an automated backup system setup using FTP- before I destroyed my FTP server(long story). This system both exported the configuration using the compact modifier to strip MAC addresses and allow for compatibility(ish) with a different device, and saved a full backup. It then uploaded both files to an FTP server elsewhere on the network.

So in my infinite wisdom(and at the instructions of the higher ups...), I'm rebuilding that system with SFTP. I can reuse the majority of my previous FTP script but I can NOT get sftp to upload files. I haven't had any issues accessing the SFTP server from any other devices using the same credentials and the server shows the connection being authorized and authenticated in the system logs. I've tried many different flavors of syntax. I'm sure I'm missing something stupid just because I've been tinkering with this for too long. I've attached the commands I'm trying below.
/tool fetch upload=yes url="sftp://[serverip]/Routerbackups/" user=sftp_user password=pwd src-path="localfile.rsc"
failure: closing connection: <no such file> 10.100.1.15:22 (10) (6)
Due to the nature of this network backup via email is possible but not reliable. What am I missing with this command?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Upload router backups via SFTP

Wed Aug 17, 2022 12:02 am

URL is a URL, is not a working directory.

You try to overwrite directory (literally) with the file content.

You must specify the remote file name.

And also intermediate directories must exist.

/tool fetch upload=yes url="sftp://[serverip]/Routerbackups/remotefile.ext" user=sftp_user password=pwd src-path="localfile.rsc"
 
tangent
Forum Guru
Forum Guru
Posts: 1333
Joined: Thu Jul 01, 2021 3:15 pm
Contact:

Re: Upload router backups via SFTP

Wed Aug 17, 2022 12:25 am

Alternately, flip the problem and pull via scp instead.

Who is online

Users browsing this forum: ko00000000001, nichky, own3r1138 and 17 guests