How can I copy a file from router

Hello,

I have this Asus router running original FW. Router does not have a physical USB port. I can access it using ssh (putty) and I can also use ssh client from router to connect NAS. Router does ping NAS fine.

I try to copy /sys/firmware/fdt file to my computer.

I have not been able to mount NAS to the router. Pscp does not work because it asks for missing /opt/libexec/sftp-server file from router. WinSPC connects using SFTP protocol, but fails file copy.

What next?

Should I make /etc/fstab file somehow to mount NAS or what?

use SCP with the legacy (-O )option, if your ssh server supports SCP and/or legacy SCP protocol.

Else other methods include local HTTP server. Check whether curl is compiled with FTP suppport etc.

edit:
dump it over console with hexdump and put it back together again =P

1 Like

Should be "WinSCP connects using SCP protocol"

2 Likes

Ends up in error:

Cannot execute SCP to start transfer. Please make sure that SCP is installed on the server and path to it is included in PATH. You may also try SFTP instead of SCP.
Command failed with return code 127.

1 Like

Let's make sure you're using SCP1 not SCP2? Else you might not have SCP in its entirety?

" To transfer files, scp1 is used (it is called from within scp). If only scp2 is allowed on your server, check the Use scp2 with scp1 compatibility option on the SCP/Shell page on the Advanced Site Settings dialog."

That's probably due to

You need to investigate the capabilities of that router first.

1 Like

Yes. It's "a bit limited".

I suppose this can be done it only I got the NAS drive mounted to the router. Tell me how to do it.

Router does give it an IP address noemally and it seems to have some EXT4 stuff in it, but simply mount -t ext4 does not work. What am I missing here?

1 Like

See if you can use tftp ["put" from the router to your server].

1 Like

if the www folder isn't read only, put a softlink to the file (ideally stored in /tmp) there, then wget it from a client.

2 Likes

Seems to be read only. It has tftp.

What does the tftp take? If I have TFTP server running on my Windows computer, how is copying made?

as @AndrewZ posted, "tftp put" ...

1 Like
ASUS:/sys/firmware# tftp put 192.168.50.206:69 ./fdt fdt2
BusyBox v1.25.1 (2024-08-22 09:34:47 CST) multi-call binary.

Usage: tftp [OPTIONS] HOST [PORT]

They have not made it easy. What's wrong here?

this, to start with.
it's busybox, the help will be minimal, to save space.

Letting port number out did not change anything

didn't say it was the only syntax error you had made ... :wink:

Was helping another user. But here's the wiki on different options?
https://openwrt.org/docs/guide-developer/adding_new_device#getting_collected_data_from_a_device

1 Like

Copying from terminal was only working solution.

1 Like

from ubuntu terminal,

scp root@<router_ip>:/path/to/file path/to/save/on/host

you can use wildcard to, ie all files from /root

scp root@<router_ip>:/root/* path/to/save/on/host/

or all .bin files from /usr/bin

scp root@<router_ip>:/usr/bin/*.bin path/to/save/on/host/

etc..

1 Like

Yeah thanks. I didn't elaborate in my earlier response.....

I've added that to the wiki now too =)

1 Like

might also be worth the mention, you can go the other way as well ..ie send file/s from host machine to router

scp path/to/file/to/send root@<router_ip>:/path/to/save/file/recieved

scp path/to/files/* root@<router_ip>:/path/to/save/files/