scp from Linux to Windows [closed]

2020-02-02 04:06发布

I am running a putty client on a Windows machine to connect successfully to a Linux box. Now I want to be able to copy a file from the Linux machine under the path /home/ubuntu/myfile to C:/Users/Anshul/Desktop on my local computer. The user at the Windows machine is anshul. I am giving the following command on putty but it is not working:

scp /home/ubuntu/myfile ip_address_of_windows_machine:C:/Users/Anshul/Desktop 

I think the path for the Windows machine is wrong. Please help as I have banged my head on a large number of forums but none seem to give correct path for Windows server. Don't suggest alternate options like WinScp

16条回答
爷、活的狠高调
2楼-- · 2020-02-02 04:23

Access from Windows by Git Bash console:

scp root@ip:/etc/../your-file "C:/Users/XXX/Download"
查看更多
ゆ 、 Hurt°
3楼-- · 2020-02-02 04:23

Try this:

scp /home/ubuntu/myfile C:\users\Anshul\Desktop
查看更多
趁早两清
4楼-- · 2020-02-02 04:24

To send a file from windows to linux system

scp path-to-file user@ipaddress:/path-to-destination

Example:

scp C:/Users/adarsh/Desktop/Document.txt root@127.0.0.1:/tmp

keep in mind that there need to use forward slash(/) inplace of backward slash(\) in for the file in windows path else it will show an error

C:UsersadarshDesktopDocument.txt: No such file or directory

. After executing scp command you will ask for password of root user in linux machine. There you GO...

To send a file from linux to windows system

scp -r user@ipaddress:/path-to-file path-to-destination

Example:

scp -r root@127.0.0.1:/tmp/Document.txt C:/Users/adarsh/Desktop/

and provide your linux password. only one you have to add in this command is -r. Thanks.

查看更多
狗以群分
5楼-- · 2020-02-02 04:25

IMHO, you would use something like the following

scp -r username_Linuxmachine@LinuxMachineAddress:Path/To/File .

The . will copy the File to the local default directory of your program. For example using GitBash, this saves the File to my configured work folder under D: drive.

查看更多
Juvenile、少年°
6楼-- · 2020-02-02 04:27

I had to use pscp like above Hesham's post once I downloaded and installed putty. I did it to Windows from Linux on Windows so I entered the following:

c:\ssl>pscp username@linuxserver:keenan/ssl/* .

This will copy everything in the keenan/ssl folder to the local folder (.) you performed this command from (c:\ssl). The keenan/ssl will specify the home folder of the username user, for example the full path would be /home/username/keenan/ssl. You can specify a different folder using a forward slash (/), such as

c:\ssl>pscp username@linuxserver:/home/username/keenan/ssl/* .

So you can specify any folder at the root of Linux using :/

Keenan

查看更多
来,给爷笑一个
7楼-- · 2020-02-02 04:27

I know this is old but I was struggling with the same. I haven't found a way to change directories, but if you just want to work with the C drive, scp defaults to C. To scp from Ubuntu to Windows, I ended up having to use (notice the double back-slashes):

scp /local/file/path user@111.11.11.111:Users\\Anshul\\Desktop

Hope this helps someone.

查看更多
登录 后发表回答