need to use scp command but with cp command and copy from Windows
GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
need to use scp command but with cp command and copy from Windows
we have been using the cp command with scp options in our environment. For some reason, the use of scp command directly without cp command never worked and did not even pursue.
Basically, used the following cp scp command when copying from one linux system to another linux system:
cp scp://<username>@<ip>/<path> <destination path>
i.e.
cp scp://root@10.123.23.11/root/mystuff .
this works.
However, I am in need to copy from Windows system to current linux system and I am not sure how I can type the source path. Has anyone done it before?
the Windows systems has scp server installed and I can use Winscp in gui mode.
not sure if following work?
cp scp://<username>@<ip>\c:\<path> <destination path>??
What distribution/version are you running? Are you running this command from a terminal window or file browser? Since you are copying files from windows to linux WinSCP is sufficient but if you want to run from a command box you can download a program from the PuTTy website called pscp.
Basically the destination is the linux box which needs to run the server and the windows computer is the client. Filezilla is another Windows sftp GUI client
I am asking about how to copy from windows using command line. Please do not post unrelated stuff and contaminate the thread:
Basically, used the following cp scp command when copying from one linux system to another linux system:
cp scp://<username>@<ip>/<path> <destination path>
i.e.
cp scp://root@10.123.23.11/root/mystuff .
this works.
However, I am in need to copy from Windows system to current linux system and I am not sure how I can type the source path. Has anyone done it before?
Sorry abut the unrelated stuff. I basically run CentOS and Debian so unless I have some frame of reference "cp scp://<username>@<ip>/<path> <destination path>" does not make sense so I am curious.
You need to use the pscp command line program which works just like the linux scp and can be downloaded from the URL below. Basic usage is:
please disregard the talk about pscp, i am not talking about copying taking place from windows. the copying entity is running from linux in which putty will not work. MichaelK appreciate your willingness to help but if you are not getting the problem fully, please do not contribute otherwise it will only cause more confusion.
Moving on, I installed the cygwin on windows machine so that it will be compatible with POSIX like commands and hopefully scp from linux can be used. Once installed, I found out c:\cygwin\tmp directory is treated as /tmp, at least when it runs from cygwin prompt.
Now, from the linux machine, I do following:
cp scp://<username>@<ip>/tmp/<filename> .
this should be the <filename> from windows location c:\cygwin\tmp\. However I am only getting
cp: cannot stat `scp://<username>@<ip>/tmp/<filename>': No such file or directory.
It helps if you explain the problem accurately. The quality of the answers is only as good as the information provided.
Is the ssh server configured and running on the Windows PC?
Code:
cp scp://<username>@<ip>/tmp/<filename> .
Is not correct syntax for either the cp or scp commands. The correct scp syntax is:
Here, I am sitting on top of my linux machine and I needed to copy from another machine using scp.
If the other machine is linux that is no issue with standard scp command.
cp scp://<username>@<ip>/tmp/<filename> .
If the other machin is Windows, I ran into problem, because syntax is not clear for path.
What you described was you might have assumed that I was sitting in front of Windows machine and trying to copy to/from linux machine. Which is reverse of what I am saying.
Saying that, I got half way done:
Installed cygwin so that Windows machine act like Linux.
However copying is still not working. It turns out sftp/ssh login works but just not scp.
It turns out the Kpym ssh server I am using has no scp server.
Installed Solarwind's free scp/sftp server however, it appears only sftp part is working for Solarwind. It looks Solarwind's tool is buggy.
SolarWind's scp/sftp has configuration where i can specify to start either or both of scp/sftp servers but when fiddling with it, I can only sftp part is working regardless of the setting.
Couple of other scp windows server tools I tried, they are not free so I abandoned 'em.
If the other machine is linux that is no issue with standard scp command.
Code:
cp scp://<username>@<ip>/tmp/<filename> .
That is not a standard syntax. There is an extraneous "cp", so if it looks like it works then it is actually doing something other than copying from the remote machine. To use "scp" to copy, use it by itself:
Code:
scp://<username>@<ip>/tmp/<filename> .
If you use "cp" first, then all the action will be local and nothing transfered either to or from the remote machine. .
Or, as already mentioned, simply use pscp.
There is pscp.exe from the putty intall for windows, and pscp from the putty-tools package for linux, which works in exactly the same way. You do NOT need cygwin for this (though it may be handy for many other things).
cp is never needed to transfer files over an ssh connection, no matter what OS you are talking about. Which really makes me wonder what your commands were REALLY doing!
The op wants the windows pc to be the server not the client.
I see. That original post is really terribly misleading.
There is a solution form BitVise that would work, and is free for personal use and about $100 if you need a license for business use. Personally, I prefer this one: https://winscp.net/eng/docs/guide_wi...openssh_server
Nothing is going to be perfect. Everyone (Except Microsoft) knows that Windows sucks at server side stuff, and this is that. That said, any of these solutions should be adequate for file transfer using sftp protocol.
Speaking of which: pscp can be set to use the sftp protocol explicitly using a simple command-line option. Sftp protocol is supported for all ssh server versions that are at all standard and compliant. scp itself as a protocol is not always supported properly, or even well defined. Using pscp, lftp, or another transfer tool that can be used with correct sftp protocol may solve problems you may face using scp alone. (Not really advice, just a comment you may want to keep in mind for future reference.)
(3) Ordinarily, they must also be running an "SSH Agent." For Windows, that is "PAgent." (Or is it, "pageant?")
With these three things in place, both secure-copying and secure shell connections can be accomplished.
Not saying you are incorrect, but number three is entirely optional, not required.
For the Linux side OpenSSH will do, is you have installed everything. Putty-tools can be added if you really like the putty style and options, or need the added features.
For the Windows side, putty serves the client part nicely. The server side requires a listener, the tools I suggested would serve. One could google for other options, there are a few free and many paid packages.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.