Alternative ways to transfer files when you do not have ftp or sftp server available
Very often I find myself having to transfer files to remote machines that do not have ftp or sftp server running.
Here are a few methods that I use in those cases:
- Using scp:
The secure copy protocol and command are part of ssh. I am assuming that you have Linux or Unix boxes that you are dealing with. If any of them are Windows computers you need to install ssh servers and clients respectively.
The command looks like this:scp source_file user@IP:pathFor example, if I wanted to copy the 1.txt file to the /tmp directory on the remote computer with ip address of 24.155.21.105 as root, I would do:
scp 1.txt root@24.155.21.105:/tmp/ - Using ssh:
cat source_file | ssh user@IP -c ‘cd /target_dir ; cat > target_file’For example if I wanted to transfer my local file 1.txt to the same remote host and save it in the /tmp directory under the name of 2.txt, I would do:
cat 1.txt | ssh root@24.155.21.105 -c ‘cd /tmp ; cat > 2.txt’ - Using netcat:
First you need to start a netcat server on your local machine to serve the files:
cat source_file | nc -l port_numberThen on the computer receiving the file you do:
nc IP port_number > target_fileFor example, if I wanted to send the same file 1.txt to the same remote computer and save it as 2.txt over port 3030 (you can chose any port, but make sure it is over 1024), I would do:
On the local computer:
cat 1.txt | nc -l 3030On the remote computer, receive the file by specifying the IP address of the machine sending the file:
nc 122.45.62.10 3030 > 2.txtAgain, note here that the ip address specified is of the computer sending the file (unlike the previous examples with scp and ssh).
No comments yet.
Leave a comment
Search
Archive
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
Recent Comments
- SteveO on Android applications that use the MyLocationOverlay class crash on the new Droid X
- dimitar on Clone Disk Drives with Ubuntu. Make an Exact Copy of Your Hard Drive.
- ranskalex on Clone Disk Drives with Ubuntu. Make an Exact Copy of Your Hard Drive.
- Jack on Quickly remove special characters from file names
- dimitar on Quickly remove special characters from file names
Categories
Blogroll
Online Tools
Other
BLOG ARCHIVE
- August 2010 (2)
- July 2010 (2)
- June 2010 (2)
- May 2010 (1)
- January 2010 (2)
- December 2009 (2)
- November 2009 (3)
- October 2009 (1)
- September 2009 (3)
- July 2009 (1)
- May 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (1)
- November 2008 (4)
- October 2008 (5)