PSFTP - File Transfer Not Happening - putty

I want a file to transfer automatically for one server to another server. For that i have installed putty.
Batch File: Transfer.Bat
cd "C:\Program Files\PuTTY"
psftp Username#RemoteServer.com -pw password -b MovementFileTransferScript.txt -be
Text File: MovementFileTransferScript.txt
open RemoteServer.com
put D:/Backup/FULL_DB_BACKUP-DontDelete.txt R:\DB\Backup
quit
In the above text file, D:/ belongs to Source Server and R:/ belongs to destination server.
When i am running the batch file i am getting the below error.
Using username "Username".
Remote working directory is /
psftp: already connected
local: unable to open D:/Backup/FULL_DB_BACKUP-DontDelete.txt
I have checked the permissions of the folders and everything looks good. Can some one let me know what was the issue here.?

Related

Jmeter-Transfer a file from server ( using ssh sftp) to local

I need to copy file from remote server to local and trying it by using SSH SFTP using JMETER.I gave login credentials and in "File Transfer" section , selected
Actions-- PUT
source path -- remote path ( /ftp/xxx/yyy)
Destination -- local path.
Received error as `
java.io.FileNotFoundException: C:\apache-jmeter-5.1.1\bin\ftp\xxx\yyy)
So I changed the Actions-- GET in View results tree for SSH SFTP response I see data of file,
but file is not copied to local directory
Any help would greatly appreciated.
All the parts of the "Destination path" must exist, i.e. you need to create all /ftp/xxx/yyy folder structure using mkdir command like:
mkdir -p /ftp/xxx/yyy
The user which executes JMeter must have write permissions to the destination path, give him the appropriate permissions using chmod command
You need to set "Print file content" to false
More information: Load Testing FTP and SFTP Servers Using JMeter
Also according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.4.1

Wget - How do I download some files from ftp server?

I am trying to download some files from a directory in ftp server. I would like to use "wget" command, but I can't get them.
ftp server URL: ftp://192.168.0.10
ftp user name: GL840
ftp password: no password
folder name in ftp: SD1/181004/
I am using the following command to download all files in the folder SD1/181004 in ftp server.
command is "wget -r -nd ftp://GL840:#192.168.0.10/SD1/181004/ -P /root/wang/powerdata/"
However, the following message is displayed and files are not downloaded.
Could you please tell me how to modify my command to download files?
I have tried accessing file on ftp server. Usually I follow the following commands and this works for me. You can give a try with this command
wget --user='GL840' --password='' ftp://192.168.0.10/SD1/181004/

Jmeter-SSH SFTP -Permission denied for download file

I am using SSH SFTP sampler to connect to SFTP. I need to download the files from SFTP. i have selected Action-"Get" and source path s SFTP file path location and destination is local folder path. I am getting error Permission denied. The same works if i try Action "ls"
Most probably the user account you're using for establishing SFTP session doesn't have read permission therefore you cannot read file contents hence not able to copy it.
Make sure that the user has read permissions and if this is not the case - provide the permission using chmod command like:
chmod +r your_file
Check out Load Testing FTP and SFTP Servers Using JMeter article for more information.
If you still experience problems - update your question to show SSH SFTP sampler configuration.

rsyncing using cygwin's rsync from the Windows Command Prompt

I am pushing a local file to a folder in a remote location using cygwin's rsync from the Windows Command Prompt.
The below command
D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com::~"overhere/"
returns the error, "failed to connect to someserver.com : connection timed out"
When I try the following command to place the file in the remote location root folder,
D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com~
it says "sending incremental file list" but I am not able to find the file in the root folder in the remote location.
What am I doing wrong?
The timeout most likely occurs because there is no rsync daemon running on the server known as someserver.com.
Using :: after the remote host name will cause rsync to try to connect to the rsync daemon running on that machine. If you use : instead, rsync will attempt a shell access to copy your data.
Your second call to rsync.exe succeeds because rsync.exe -avh data.csv c2-user#someserver.com~ creates a copy of data.csv in your current working directory named ec2-user#someserver.com~.
If you use shell access, you can directly provide the path after the :, if using the rsync daemon, you have to provide the module name as configured in /etc/rsyncd.conf on the server after the ::. So in your case it is either ec2-user#someserver.com:~/overhere/ for shell access or ec2-user#someserver.com::MODULE for the daemon.
But as I suspect that you have no rsync daemon running on the remote machine, you'd have to install and configure it first for the second version to work. The first version will do through normal SSH access.
So as a first attempt you can try: D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com:overhere/
This will create a folder named overhere in the ec2-user's home directory on someserver.com if it doesn't already exist and copy the local data.csv into that directory.

bash script to sftp files with a password from remote directories to local folders

How to write a bash script using sftp command to download files?
I can use the following command to login to the remote machine, however I need to type in the password manually.
bash-3.2$ sftp -o "Port 22022" mike#s-edm-ssh.local.files.stack.com
mike#s-edm-ssh.local.files.stack.com's password:
Connected to s-edm-ssh.local.files.stack.com.
sftp>
How to do the sftp without the password prompt?
If I like to download aaa.txt file at /remote/mike/files to my local directory /local/mike/downloaded, how to build a script to do all of these work?
Since sftp runs over SSH, you can place your public key on the remote server.
If for some reason you can't place your key on the server, then you can write an Expect script to send your password when the prompt appears. See this example.

Resources