Transfer file from one server to other
Hi i want to know is there any command to transfer file from one server to a local machine in our office.
For example our server is 88.44.44.55 and our router's ip is 66.33.22.11 and my local ip is 192.168.1.1, Now i want to transfer file from 88.44.44.55 to my own linux machine 192.168.1.1. Is it possible??? Thanx In Advance |
of course it's possible. I'd suggest scp to start with as the simplest way. Obviously you need to be able to reach one machine from the other first.
|
Thanx acid_kewpie
This 88.44.44.55 ip is provided by our broadband service provider. Can u please give me example of command line in linux??? |
I want to write a script to automatically download backup from our server.
|
there are a lot of solutions, but mainly they are a pair of client-server applications.
So you can try scp, ftp, rsync, wget (these are the clients to work with), but all of them require a server (or at least some configuration) on the other side. In general office can restrict the outgoing traffic and block incoming, so you need to set a server at home and run the client in the office. The router also should be configured to redirect the requests to your host. |
I'm sure you can read the scp manpage for this, it's not hard to look up.
scp user@destination:/where/the/file/is/file.txt /where/the/file/goes |
In destination which ip should b giver the local machine ip or 88.44.44.55?
When i paste 88.44.44.55 the reply is ssh: connect to host 88.44.44.55 port 22: No route to host lost connection |
We have no idea how your network is set up do we? give us some useful information to start with and we can try to work it out. but it's a big jump from having possibly no connectivity to copying a file, so work out what your current problem is first, before trying to fix an unrelated one.
|
We download Backups from our server daily. Log files of radius and asterisk.
I want to write a script which automatically download files on our computer, Our server is in Germany and our office is located in Pakistan. the service provider gives us 88.44.44.55 ip, and our backup computer which save backup have ip 192.168.1.1, now i want to transfer backup directly to our backup computer. i m using this command scp blackup.out root@88.44.44.55: /root but i m getting this error ssh: connect to host 88.44.44.55 port 22: No route to host lost connection |
ok, that's repeating the stuff we DO know. how about the stuff we DON'T know? where does this public IP fit into it? Is internet involved etc..? what is the layout of your network? What security devices are involved? What device does this public IP reside on?
|
you can try traceroute 88.44.44.55 for example
|
traceroute to 58.65.154.78 (88.44.44.55), 30 hops max, 40 byte packets
1 xx6651142097.cipherkey.com (66.55.44.97) 0.577 ms 0.593 ms 0.645 ms 2 xx208110096072.cipherkey.com (208.110.96.72) 0.264 ms 0.211 ms 0.194 ms 3 ge-6-10-340.car3.seattle1.level3.net (4.71.152.129) 4.955 ms 4.872 ms 4.858 ms 4 ae-32-52.ebr2.seattle1.level3.net (4.69.147.182) 11.157 ms 11.168 ms 11.124 ms 5 ae-2-2.ebr2.denver1.level3.net (4.69.132.54) 30.918 ms 31.172 ms 31.033 ms 6 ae-3-3.ebr1.chicago2.level3.net (4.69.132.62) 55.964 ms 55.760 ms 55.861 ms 7 ae-1-100.ebr2.chicago2.level3.net (4.69.132.114) 56.063 ms 56.006 ms 66.339 ms 8 ae-6-6.ebr2.washington12.level3.net (4.69.148.145) 76.714 ms 74.675 ms 70.754 ms 9 ae-5-5.ebr2.washington1.level3.net (4.69.143.221) 70.921 ms 70.751 ms 70.549 ms 10 ae-41-41.ebr2.paris1.level3.net (4.69.137.49) 150.292 ms ae-42-42.ebr2.paris1.level3.net (4.69.137.53) 150.588 ms 150.081 ms 11 ae-22-22.ebr1.paris1.level3.net (4.69.143.121) 150.438 ms 149.545 ms 150.298 ms 12 ae-1-7.bar1.marseille1.level3.net (4.69.143.237) 159.758 ms 160.404 ms 161.215 ms 13 ae-2-3.edge2.marseille1.level3.net (4.69.143.250) 160.401 ms 162.066 ms 160.738 ms 14 213.242.115.6 (213.242.115.6) 271.851 ms 213.242.115.2 (213.242.115.2) 272.715 ms 272.762 ms 15 static-10ge-khi494-p01-khi494-swb.pie.net.pk (202.125.128.157) 271.800 ms 270.202 ms 270.390 ms 16 rwp44.pie.net.pk (221.120.254.5) 294.432 ms 291.254 ms 292.492 ms 17 rwp44.pie.net.pk (221.120.253.10) 293.783 ms 293.879 ms 292.322 ms 18 rwp44.pie.net.pk (221.120.237.102) 301.394 ms 301.483 ms 292.447 ms 19 mbl-65-154-78.dsl.net.pk (88.44.44.55) 293.415 ms 293.367 ms 293.744 ms This is the reply |
so what IS 88.44.44.55?
|
This ip is assign to us by our internet provider.
Internet is involved. |
I would try a port scan, which ports are open, what can you reach from the other side?
do you know nmap? |
No i dont know, Basically i m new on linux :(
|
Quote:
You're REALLY making us work FAR too hard for this... |
This is server
|
What is the result of nmap -p1-10000 -T4 -sS 88.44.44.55
|
Hmm, ok so putting your server directly on the net is a REALLY bad idea... you should change that. Unless this is some one off hosted service.
But at least it should make it simple, and you should only need to open port 22 to that interface and go off from there. What distro is the server? You can show us your iptables output ("iptables -vnL") and also actually confirm that ssh is running with a "netstat -plnt". How do you get into this box at present if you can't ssh to it? |
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2012-04-19 01:48 EDT
Interesting ports on mbl-65-154-78.dsl.net.pk (88.44.44.55): Not shown: 9984 closed ports PORT STATE SERVICE 20/tcp filtered ftp-data 21/tcp filtered ftp 22/tcp filtered ssh 23/tcp filtered telnet 53/tcp open domain 80/tcp open http 123/tcp filtered ntp 443/tcp filtered https 3306/tcp filtered mysql 3389/tcp filtered ms-term-serv 6080/tcp filtered unknown 7070/tcp filtered realserver 7554/tcp filtered unknown 8000/tcp filtered http-alt 8080/tcp filtered http-proxy 9554/tcp filtered unknown Nmap finished: 1 IP address (1 host up) scanned in 117.442 seconds |
So 88.44.44.55 is the public IP of your router in Pakistan?
|
Yes sir...
|
Chain INPUT (policy ACCEPT 33 packets, 3561 bytes)
pkts bytes target prot opt in out source destination 33 3561 asterisk all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 asterisk all -- * * 0.0.0.0/0 0.0.0.0/0 Chain OUTPUT (policy ACCEPT 32 packets, 3230 bytes) pkts bytes target prot opt in out source destination Chain asterisk (2 references) pkts bytes target prot opt in out source destination 0 0 DROP all -- * * 178.33.62.28 0.0.0.0/0 0 0 DROP all -- * * 37.58.74.106 0.0.0.0/0 Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2752/./hpiod tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2875/mysqld tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 2792/xinetd tcp 0 0 0.0.0.0:5038 0.0.0.0:* LISTEN 2975/asterisk tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2486/portmap tcp 0 0 0.0.0.0:2000 0.0.0.0:* LISTEN 2975/asterisk tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 3194/Xorg tcp 0 0 0.0.0.0:1008 0.0.0.0:* LISTEN 2522/rpc.statd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2770/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2779/cupsd tcp 0 0 0.0.0.0:1720 0.0.0.0:* LISTEN 2975/asterisk tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2908/sendmail tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 2757/python tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 7912/java tcp 0 0 :::8009 :::* LISTEN 7912/java tcp 0 0 :::8080 :::* LISTEN 7912/java tcp 0 0 :::6000 :::* LISTEN 3194/Xorg tcp 0 0 :::80 :::* LISTEN 2936/httpd tcp 0 0 :::22 :::* LISTEN 2770/sshd tcp 0 0 :::443 :::* LISTEN 2936/httpd |
Quote:
|
Sorry i just waste lot of ur time...
88.44.44.55 This is our server that is in Germany. 66.33.22.11 This the public IP of our router in Pakistan. 192.168.1.1 This is my computer's IP. |
So you have ssh access to your server in germany to download your logs manually?
I assume yes so ... The command to schedule on your client machine would be Code:
you@client:-$ scp user@server:/path/to/logfile /local/path/to/put/logfile |
Should i run this command on our server???
|
I need a command which i run on 88.44.44.55 and backup downloaded on 192.168.1.1.
|
No, you run it on your client.
---------- Post added 04-19-12 at 09:18 PM ---------- Quote:
You are having enough trouble doing it the easy way... |
Because i made a script which automatically make .tar.gz file and i want to add this command so after completing the compression it download the file...
|
OK.
Presumably you have a static public IP in Pakistan? If not, then it won't work if your IP keeps changing every few days... So you will need to set up ssh-server on your Pakistan machine, along with key-based auth, and forward an appropriate port (probably NOT 22 would be best) on your router. |
Our ip is static.
Can u please explain the procedure little bit. |
I just did.
|
clearly someone needs their hand held so let me see if i can put an end to all of this madness.
you want to scp a tarball from your server to your workstation (its easier to do it vice versa but whatever) client config: you'll need to setup an openssh server on your workstation (ill leave that up to you to figure out) make sure openssh is started, a quick way to determine this is to do `nmap localhost` - look for 22 OPEN if you're running iptables or some kind of firewall you'll also need to make sure port 22 is accepted/permitted router: im not sure what kind of router you have in Germany but either way you'll need to setup port forwarding (nat statements) TO your workstation on port 22 server: if you can ssh from your server to your workstation then you'll obviously see traffic is working as it should. from here you'll need to set up a key pair so you can ssh without a password as noted earlier in this thread. a good tutorial of this is here http://www.thegeekstuff.com/2008/11/...n-ssh-copy-id/ if you've made it this far and everything is working like it should you can no go ahead with whatever method you want to use to transfer your files you@server:-$ scp user@client:/path/to/logfile /local/path/to/put/logfile a cron job w/ scp would be a good option the rest is up to you... |
Quote:
Code:
you@server:-$ scp /local/path/to/logfile user@client:/remote/path/to/put/logfile |
Quote:
|
Thanx Every one, Problem Solved :)
|
All times are GMT -5. The time now is 03:34 AM. |