batch copy files from windows to linux
-
09-02-2021 - |
سؤال
I have a lot of linux driven devices which I need to configure and setup. All devices have same root pass. Now I need to copy files on those devices.
One way is using pscp.exe
, but this utility requires interaction, prompting The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
message.
Actually, I don't need secure copy, I just need to copy files in batch mode for any given device without user interaction. How can I do it?
المحلول
If you just connect to the server once with putty and accept the server's key, you'll be fine, and pscp
won't nag you afterwards.
Other options would be a writable smb share ( or nfs if you fancy that) , an ftp server, ...
نصائح أخرى
With help of plink.exe
it is possible with simple:
echo y | "PLINK.EXE" -pw pass user@%ip% echo foobar > nul 2>&1 || goto myError
Now I can use pscp
without worry that it will request undesired interaction.