1

I am using ssh on a remote linux machine from my desktop using putty. I want to copy a txt file which is in the desktop of my local windows machine to the remote linux directory. How can i do that using shell when i am logged in to remote machine using ssh? Thanks for the help!

kofhearts
  • 2,845
  • 5
  • 30
  • 65
  • 1
    PSCP, the PuTTY Secure Copy client, is a tool for transferring files securely between computers using an SSH connection -- http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html, http://stackoverflow.com/questions/5492023/transfer-files-command –  Sep 13 '14 at 19:21
  • I would suggest you use [WinSCP](http://winscp.net/eng/index.php) when you copy from your local Windows to a remote linux directory. – Elliott Frisch Sep 14 '14 at 01:24

2 Answers2

5

Yes it can be possible, but you need additional software for that. Both Putty or Git bash will work. Since I use git as VCS, I also use it to send files from my Window 7 laptop to remote AWS Linux machine.

Example login:

ssh -i key.pem user-name@public-dns **or** ip-address

To send a file from Window to remote (like AWS ec2):

scp -i key.pem file.txt user-name@public-dns:~/

To send a directory from Window to remote:

scp -i key.pem -r directory_name user-name@public-dns:~/

To receive a file from remote to Window:

scp -i key.pem user-name@public-dns:/file-address/file.txt any_name.txt

To recieve a directory from remote to Window:

scp -i key.pem -r user-name@public-dns:/directory-address/directory any_name
Sushant Magoo
  • 314
  • 3
  • 12
1

Open Git Bash and go into the location where the file to be copied then execute below the line in Gat Bash

scp -r user_name@<ip_address>:/<file_location> . 

Example:

scp -r root@10.1.192.11:/piyush/upadhyay/sofcon_data .
Rohit
  • 1,859
  • 12
  • 28
piyush
  • 11
  • 1