LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2010, 11:40 AM   #1
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Rep: Reputation: 19
SSH/SCP help


On my own I've managed to set up SSH on my home router and login from a remote location, and from there SSH into my personal computer, but now what I can't figure out is how to transfer files from my home PC to the remote location and vice versa via scp. Is there a way to specify a PC behind my router? ie. root@my.router.ip.address/username@192.138.1.101? (I know that syntax wouldn't be correct) It seems like this would be fairly simple, but I'm not sure what to look for next. Is this what port forwarding is for?

Thanks,

-Jinouchi
 
Old 02-04-2010, 11:43 AM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
did you try sftp for file transfer purpose? and ssh forwarding?
you can forward a port on your pc behind router to local one, and connect with sftp to it like it's on your current PC.
 
Old 02-04-2010, 11:45 AM   #3
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
...Wow, that was fast. I have not tried sftp, nor ssh forwarding. How does forwarding work?
 
Old 02-04-2010, 11:48 AM   #4
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 43
You need to know the public IP of your network(PC behind the router). For your home PC you can visit www.whatismyip.com (either in lynx or GUI browser(firefox/IE/etc)


The syntax would be:

scp /path/to/file/on/local/machine/file username@ipaddress:/path/to/location/on/remote/machine

OR

scp username@:/path/to/location/on/remote/machine/files /path/to/location/on/local/machine



Or you need the public IP of your remote computer you're SSHing from.

Last edited by ncsuapex; 02-04-2010 at 11:50 AM. Reason: .
 
Old 02-04-2010, 11:52 AM   #5
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
Right, I've gotten that far, but the problem is that in order to get to my PC I have to go through my router. So there's really three IPs involved here. So basically, from a remote location, what is the path to my PC (which is behind my router)?
 
Old 02-04-2010, 11:59 AM   #6
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 43
Ahh... I misread that. I just have port 22 open on my router for my PC. Then when I scp/ssh into my public IP it goes straight to my Linux PC. Not sure how to do what you're trying.
 
Old 02-04-2010, 12:03 PM   #7
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
Oh, ok, I figured that must be what forwarding did... I'll have to figure out how to set that up and get back to you. Thanks.
 
Old 02-04-2010, 01:32 PM   #8
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
Well, I've set up my router to forward port 22 to my IP (or so it seems), but when I ssh into my external IP I still ssh into my router... Shouldn't my router be passing the ssh request straight to my computer instead of handling it itself? (see attachment)

(I've set SSH to use port 2020 on my machine, in case you're wondering.)
Attached Thumbnails
Click image for larger version

Name:	port_fwd.png
Views:	11
Size:	41.6 KB
ID:	2653  
 
Old 02-06-2010, 12:05 PM   #9
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
Anyone know what I'm doing wrong?

Last edited by Jinouchi; 02-13-2010 at 11:31 AM.
 
Old 02-14-2010, 11:37 PM   #10
Jinouchi
Member
 
Registered: Jul 2007
Location: WI, USA
Distribution: Debian, Lenny
Posts: 111

Original Poster
Rep: Reputation: 19
Aha! I found out what was wrong. I correctly configured port forwarding; HOWEVER, I had SSH Management enabled. I disabled this (Administration > Management > SSH Management) and all seems to be working fine now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 03:23 AM
scp and ssh linderox Linux - Networking 2 11-19-2007 03:04 AM
SSH/SCP with no password wh33t Linux - Software 11 06-10-2007 12:38 AM
ssh and scp problem DAChristen29 Linux - Networking 4 01-05-2005 05:27 PM
Ssh/scp Gui MattLaw Linux - Networking 2 02-18-2004 05:45 PM


All times are GMT -5. The time now is 10:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration