Python Module to copy files between two remotes - python-3.7

I have tried many modules like sftp, paramiko, fabric but I am failing in framing logic for file copy between two servers.
Scenario:
Server - A is my local linux machine, which has copy_files_remotely.py
Server - B is source remote which consists of sample.txt file
Server - C is destination remote which needs to copy sample.txt file to /home/user
How to execute copy_files_remotely.py which copies file from Server-B to Server-C by providing both the credentials ?

Related

VSCode SFTP deploy files from remote SSH server to a second remote SSH server

I have two remote SSH servers, server A (dev) and server B (production). When working on files on server A via SSH in VSCode, I want to be able to upload / sync files to server B using the SFTP plugin.
I can see how this is done when working on a local file system and then deploying via SFTP to a single remote SSH server, but I want to know if it's possible to deploy from one remote SSH server to another.
Any help greatly appreciated.

Installing agents on solaris remotely

In regard to Uptime.
I want to install the agents on solaris machine remotely through putty.
Now for that, I have established(logged in) a connection to that system successfully.
following this, my next step would be to "Using a file transfer method such as FTP, transfer the archive containing the Agent to the system on which you want to install it. You should copy the archive to a temporary directory on the system."
Now my problem is that i am unable to transfer the archive containing the agent, to the system on which i logged in through putty.
I have searched this command to transfer the files rcp machinename:source destination
here my machine name is:
\uptime-share.uptimesoftware.com\css\Releases\Agents\Solaris
source : uptimeagent-7.2.1-solaris-sparc
destination : 172.20.98.14/tmp
but after using this command i get the message connection refused.
Could someone help me to do this.
I used this command
rcp 172.20.32.11:/css/Releases/Agents/Solaris:uptimeagent-7.2.1-solaris-sparc 172.20.98.14/tmp

Nagios - NRPE commands definitions

I have a Nagios server with 10 servers monitored. I'm using hostgroups and NRPE to check Cpu and Disks.
But by default, check_disk command definition doesn't exist in the NRPE configuration file.
Is there any way to define these alias commands only on the Nagios Server ?
I would to avoid to change the NRPE config file on each server...
Thanks.
Nagios server connects to the monitored server via NRPE and execute the defined command in the remote nrpe.cfg file. So, the command must exist in the nrpe config file of the server to be monitored.
In the other hand, the list of the nrpe commands to be executed in the mentioned remote server is located under the nagios server: .../nagios/configurations/objects/server1.cfg
To summarize:
In Nagios server:
Define the command in the corresponding server's cfg file. (The name of the check, the servers/server groups to be checked etc.)
In Monitored server (for every individual server):
Add the command in nrpe.cfg. (Show the checker script's path and give parameters.)

transfer file from server to home computer

I have a text file on the server(linux) at work and now I am at home. I am a putty user. to connect to the server from home I have to connect to another server (which means I can connect to the server at work, indirectly from home) so I can't use scp command or winscp to transfer or copy my file to my computer at home. does anybody know that how I can transfer or copy my file from the server at work to my home computer(windows system)? thanks.
Since it's a text file, putty's capture feature should work for you. In putty, the capture feature is in Category Session → Logging. Just specify the local filename that you want to save the text file to on your Windows machine, then use Linux's cat command to cat the file on the remote Linux host. With capture enabled in putty, it should save the output of the cat command (i.e. the contents of the text file) to a file locally on your Windows machine.

copy file to remote desktop drive

I want to copy a file from my local C:\filename.png to the remote computer to which I am connected via remote desktop's C:\ drive.
Is it possible to copy using powershell or anyother terminal command?
I am using windows 7 (local PC) --- Remote Desktop (Windows Server 2003)
If your host's c: drive is injected into a terminal services session, it just gets a new drive letter in the remote session.
On my network, my host machine's drives are injected into a VM and C: becomes M:.
So in that case, in the remote session:
copy c:\file.png m:\png
BUt perhaps a beter way - from your host:
Copy \\remote\c$\file.png c:\file.png
My remote session usually names the local resource tsclient, such that I can browse my local C drive with this PS command:
Set-Location \\tsclient\C
then I can do anything I would normally do on the local file system, e.g. copying:
copy \\tsclient\C\file.txt C:\file.txt
You can share a folder on your server and map it as network drive on the client computer. Then you can use the copy command.
At the server side you kann check and deplace the files manually or with a program.
if both are Windows 7 ;
Just copy and paste done in ordinary window
If both machines run the same OS, then it can be achieved
If you are using mstc program then
Go to Remote Desktop Connection -> Options -> Local Resources -> check the drivers option and connect to the remote PC. Then you can perform copy paste like usual