LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2022, 04:56 PM   #1
bomberb17
Member
 
Registered: Jul 2005
Posts: 71

Rep: Reputation: 0
Downloading a file through gateway openwrt system


My openwrt home router is accessible from ssh as
Code:
ssh homerouter.ddns.net -p 1234 -l userA
. From within the internal home network, a linux host is accessible as
Code:
ssh 192.168.1.100 -p 5678 -l userB
Both ssh servers do not have ssh keys and use password authentication.

I am looking for the cleanest way to download a (relatively small) file from the internal host to my laptop while being outside the internal network. I found online a command similar to this one below, but it doesn't work (the terminal gets unresponsive)

Code:
scp -J userA@homerouter.ddns.net:1234 ~/Downloads/ userB@192.168.1.203:5678/path/to/file.txt
Is scp the best command/cleanest way for this? And what is the correct way?

Last edited by bomberb17; 12-19-2022 at 05:02 PM.
 
Old 12-19-2022, 11:10 PM   #2
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
colon port is not valid ssh syntax, it is not a URL. It is either -p port or you can add it to your custom ssh_config in .ssh/ssh_config of your homedir on your client and/or your jumpshost.

https://www.cyberciti.biz/faq/create...on-linux-unix/
 
Old 12-21-2022, 04:33 AM   #3
bomberb17
Member
 
Registered: Jul 2005
Posts: 71

Original Poster
Rep: Reputation: 0
I tried

Code:
scp -J -p 1234 userA@homerouter.ddns.net ~/Downloads/ userB@192.168.1.203/path/to/file.txt -p 5678
but it doesn't work.
So what is the correct syntax for this?
 
Old 12-21-2022, 09:00 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
The correct syntax is always source destination, to download a file from your home to your laptop:
Code:
scp -J userA@homerouter.ddns.net:1234 -P 5678 userB@192.168.1.100:/path/to/file.txt ~/Downloads/
You can add a -v to see some additional debug code.

Code:
scp -v -J userA@homerouter.ddns.net:1234 -P 5678 userB@192.168.1.100:/path/to/file.txt ~/Downloads/
You can use a config file in your ~/.ssh directory that basically creates a short cut to keep from having to always type in the entire command

In your original post you used two different IP addresses for your linux host i.e.
192.168.1.100 versus 192.168.1.203

Last edited by michaelk; 12-21-2022 at 09:03 AM.
 
  


Reply

Tags
scp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 10G WiFi gateway runs OpenWRT on 64-bit Freescale QorIQ LXer Syndicated Linux News 0 09-12-2015 04:22 AM
Route all traffic through GRE tunnel in OpenWrt [SOLVED] password123 Linux - Networking 4 09-08-2015 03:00 PM
Force server to route through a specific IP with OpenWRT think_like_a_geek Linux - Networking 2 07-27-2015 01:48 PM
[SOLVED] Cross Compiling in OpenWRT. Cannot Execute binary file. Ideas? aztroboy Programming 4 02-15-2011 12:36 AM
[SOLVED] Starting File System .. Starting File System .. Starting File System .. Starting File rmknox Linux - Newbie 3 08-15-2010 11:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration