dslreports logo
 
    All Forums Hot Topics Gallery
spc
uniqs
151

squircle
join:2009-06-23
OTWAON10

squircle to nu2this

Member

to nu2this

Re: wget command in terminal to download files via ssh?

As mentioned, you're looking for scp. The syntax is scp user@host:/path/to/file /destination/file.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

ahhhh... you just showed me what i missed... the colon between lemme try... thanks!
nu2this

nu2this to squircle

Premium Member

to squircle
admin:Desktop admin$ scp admin@192.168.1.145:/Users/admin/Desktop/ENIGMA.jpg
usage: scp [-12346BCEpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2

dennismurphy
Put me on hold? I'll put YOU on hold
Premium Member
join:2002-11-19
Parsippany, NJ

dennismurphy

Premium Member

said by nu2this:

admin:Desktop admin$ scp admin@192.168.1.145:/Users/admin/Desktop/ENIGMA.jpg
usage: scp [-12346BCEpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2

Need a destination.

scp username@destination:/Path/To/File/On/Remote/Site/filename /Path/To/Destination/filename

for example:

scp fred@flintstone.org:/tmp/barneys-cell-phone-num.txt .

(the . is the current working directory, so it'll copy the file from flintstone.org to the current directory.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

YOU ARE AWESOME! thanks!
so freaking cool!

thank you so much!
nu2this

nu2this

Premium Member

now on to the next issue... to do this outside of the network (from my home to the office)

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

said by nu2this:

now on to the next issue... to do this outside of the network (from my home to the office)

You will need to port forward port 22 on your router to the internal IP address of the machine you want to copy to/from. Then assuming your company doesn't have a firewall, you can do the same thing with scp.

If there's a firewall in place, depending on what OS at work you have, you can use putty or there are various proxy navigators you can plug into OpenSSH's .ssh/config file.

We need more info about your work setup and whether there's a firewall there preventing outbound connections to port 22.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

Click for full size
I have a firewall...

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

I believe the port forwarding for that router would be under "Applications & Gaming", but not 100% sure.

The firewall I was asking about was at your work. Does your work restrict connections only to port 80/443 (for web browsing) or is there a proxy configured in your browser at work in order to connect to web sites? Or do you connect directly with no proxy?

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this to pflog

Premium Member

to pflog
on the cisco LInksys E2500 / Applications and Gaming tab... i went to single port forwarding

External Port 22
Internal Port 22
Protocol BOTH (tcp udp)
to IP Address (can't be left blank) it's all 192.168.1. (fill in last 3) only option

and then check the box to Enable

but I don't think this works from outside of the network.
nu2this

nu2this to pflog

Premium Member

to pflog
it's my office. I don't have an IT guy... lol (me i guess) I haven't setup any firewalls (other then what is coming from the router as default and/or ISP COMCAST XFINITY as default. nothing extra.

I am running 10.8.2 on all my macs (office and home)

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog to nu2this

MVM

to nu2this
Yes, it will if that's your only router. So now you should be able to, in theory:

ssh youruser@public_ip_on_router

If so, scp should work in the same manner. You won't be able to scp FROM home to work, but you can accomplish the same thing buy initiating the scp always from the work machine:

from work to home:

scp /path/to/local/file homeuser@home_public_ip:/path/to/file/at/home
 

and from home to work:

scp homeuser@home_public_ip:/path/to/file/to/copy /path/to/file/at/work
 

But this all depends whether your work blocks outbound port 22 or not...

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

how can i see if router port 22 is blocked? and can i try to connect to public ip from inside the office to test? or will it get errors?

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

said by nu2this:

how can i see if router port 22 is blocked? and can i try to connect to public ip from inside the office to test? or will it get errors?

Just get the external IP address of your home router (should show up via the web interface status). Then try to ssh from your work computer. You can add -vv to the command to see verbose output to see when it attempts to open the socket to connect. If it hangs, it's probably still being blocked/firewalled on your home connection.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

I have two computers on my desk here at office.

I went to what's my ip address and got my public ip.
opened CyberDuck on other computer
chose SFTP ssh file transfer protocol
server (public ip address) port 22
username (of computer)
password (of computer)

not able to connect

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

No, that's the public IP of your WORK connection. If you're connecting to home, you need to get the public IP of your home connection.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

i have tried ftp-ssl , ftp , ssh
i get network timed out and connection refused

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

said by nu2this:

i have tried ftp-ssl , ftp , ssh
i get network timed out and connection refused

Are you at work or at home when trying to ssh? Did you get the IP of your home connection?

home(HOME_external_ip)-----[internet]-----(WORK_external_ip)work

If you're AT work on "work computer", then you need to find out "HOME_external_ip" and then:

ssh usernameonhomecomputer@HOME_external_ip

It should work if you have properly forwarded port 22 on the home connection's router.

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this to pflog

Premium Member

to pflog
i do not have the public IP of home connection. I am trying to do this using two different office computers (using public IP of one of these computers here in the office)

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

said by nu2this:

i do not have the public IP of home connection. I am trying to do this using two different office computers (using public IP of one of these computers here in the office)

That will not work. It takes special NAT rules to be able to access an external IP address from behind NAT. Simply, it's not going to work.

You will need to get he public IP of the home machine and port forward 22 there in order to ssh from work to home. If you want to ssh from home to work, then you need to port forward 22 there as well and need to know the external IP for whichever place you're connecting TO.

A dynamic dns service liked dyndns.org can help with this so you can configure your routers to update your dynamic hostname when they change IPs, so that you can connect via a host name instead of having to look up the IP address if it changes when DHCP leases are renewed (rare).

nu2this
NOT
Premium Member
join:2005-04-07
Hallandale, FL

nu2this

Premium Member

ok... thanks... i'll take this info that I have and try it later when I get home.

much appreciated!

Thinkdiff
MVM,
join:2001-08-07
Bronx, NY

1 edit

Thinkdiff to pflog

MVM,

to pflog
said by pflog:

said by nu2this:

i do not have the public IP of home connection. I am trying to do this using two different office computers (using public IP of one of these computers here in the office)

That will not work. It takes special NAT rules to be able to access an external IP address from behind NAT. Simply, it's not going to work.

That's not exactly true. Many consumer or entry-level business grade routers support NAT loopback by default. In my experience, the chances of it working are greater than the chances of it not working. That being said, unless you know your router supports it or has an option to specifically turn it on, you'll never know if your port forwarding is failing or the router is blocking it.

OP: If you have an iPhone, you can download Prompt, iSSH, or a free SSH client (if there are any) and try using your 3G connection. Or just wait until you get home

pflog
Bueller? Bueller?
MVM
join:2001-09-01
El Dorado Hills, CA

pflog

MVM

My knowledge of SOHO routers is dated. I know that in the past it was not very likely to work on most. If that's changed, I stand corrected.