Copying files to a remote server over FTP protocol - ftp

I use Filezilla to do my FTP duties and I'm unable to copy files without making a copy to the my local computer.
I doubt Filezilla is bad software. Is this just an inherent quality of FTP?

The FTP Protocol does not define a "copy" command.
If your FTP client has a copy command, then it has to implement this itself using what's available through FTP. This works out to something like: GET/RETR , CWD , PUT/STOR .
Some FTP servers will implement proprietary extensions and offer a command like COPY. A client may or may not choose to implement these, in which case it doesn't involve a local file copy.

According to the error messages I get within WinSCP when I try and duplicate or copy.. apparently it is.
I'm guessing there's some FTP theory on it somewhere. Even to duplicate WinSCP wanted to temp dump stuff to my local machine.

There aren't any copy commands listed at the list of FTP commands, so it's not in the FTP definition. It's just something FTP clients add themselves to be more user-friendly.

Related

How can I schedule the transfer of a CSV file resulting from a Snowflake query to an FTP server? [duplicate]

I have a simple question. I want my Windows 7 PC to send a file to Linux server every minute. This would be easy to do on Linux via cronjobs but I have really no idea how to do that on Windows.
For example. We have a file called example.txt in c:/programfiles/folder/ on my Windows PC.
I want to send that file to Linux server to folder /home/fold.
Any idea what to use and how? Does Windows have anything similar to
cronjob? What to use instead of scp? Maybe use FTP but my Linux server
only works with explicit TLS and I have no idea how to force ftp
client to send that file in Windows.
Ty in advance and sorry if I ask stupid question.
Windows equivalent to the cron is Windows Task Scheduler.
The Windows ftp.exe client does not support TLS/SSL. It also does not support a passive FTP mode. So you have to use a different client. Once you have to use a different client anyway, you can use SFTP.
So take any scriptable SFTP client (or FTPS or SCP client if your prefer) and schedule it to be run using Windows Scheduler.
For example with WinSCP, you can use a batch-file like:
#echo off
winscp.com /log=winscp.log /command ^
"open sftp://user:password#example.com/" ^
"put c:\path\file.txt /path/" ^
"exit"
(WinSCP supports FTPS and SCP too).
Then, in Windows control panel go to System and Security > Administrative Tools > Schedule Tasks and add a new task.
For details see my guide for scheduling file transfers to FTP/SFTP server.
(I'm the author of WinSCP)

Error: Requested action not taken. file name not allowed

I am using UltraEdit for FTP. While saving my files to other server using FTP I am getting above error as ;'Error: Requested action not taken. file name not allowed'.
Could anyone know the possible cause and solution for it.
Thanks in advance
Well, the FTP server returns error code 40553 - Requested action not taken. File name not allowed.
The reason is most likely a bad character in file name, or a too long file name, or there is a file already on the server with same name and you do not have the permissions to overwrite this file.
You could also have made a mistake in the FTP account configuration like a typing mistake in initial directory.
Do you have downloaded the file from the FTP server before you tried uploading it?
Please note that Unix file systems most often used on FTP servers are case-sensitive and therefore a file with name "MyFile.txt" is a different file than "myfile.txt".
Finally, very often a firewall blocks data transfer in a separate data channel established from FTP server to FTP client module in UltraEdit. In this case the option Passive transfers (for firewalls) should be enabled on the Server tab of this FTP account in the FTP Account Manager window.

create a folder in remote server and copy a file there in vb.net

I tried searching on net for hours but couldn't get any useful answer. It would be of great help if I could be provided with a code accomplishing this.
I have IP address of a remote server which is password protected (it needs user name and password to login)
I need to write a code in VB.NET that creates a folder in this remote server and copies a file from local server (in which the code is executing) to the remote server.
thanks in advance
This is not technically possible, its a way of hacking.
Thats why we have other technology to do it i.e. FTP, SFTP, Webdav.
I would suggest you to do same, use either of above technologies and do your stuff.

On the fly file encryption in Windows server 2008 R2

Is there a possibility to encrypt a file "on the fly" in windows while copying file via FTP to remote storage?
i don't know if that description is good enough but i want to do something in the way of gpg -e file > ftp://xxx
or will i just have to rely on cygwin?
i'm using windows server 2008 R2 and the file i'm copying is around 750GB in size so it's not possible to encrypt it first and then copy it.
The file as written to local storage via ftp will simply reflect the bytes sent to it from the client. It would have to be encrypted after it was received,b as ftp has no native encryption that I know of.
Not with anything built in to FTP. If you used SFTP or SCP, or WEBDEV over SSL/TLS, you could get encryption for trassport, but the data on the other end will still be encrypted. In fact, the lack of encryption ( for transport) in FTP was why SFTP was developed
If you don't mind writing some code, you cause C# to encrypt data as its copying it over very easily.
Get a crypto-stream from AES and simply back the stream with a network stream/ftp stream . This should avoid writing the data back to disk. You'd simply be reading of disk a few bytes at a time, encrypting, and then writing the data to the network.
You might be able to do a similar thing with powershell.

Receive File via SFTP/SSH and automatically forward to FTP on another server

I'm currently in a situation where I receive flat files via FTP from my clients. A couple of clients have insisted on the need to use SSH Private Key SFTP rather than regular FTP.
What I want to do is setup a web server (preferably in linux/unix but I guess I can do it on a windows server and purchase SFTP server software) that will do the following:
Allow me to setup an SFTP directory for each client with unique user/pass. Each directory also has to have the public/private key SSH "stuff" I'm a little new to this but I've googled it.
Once the file is completely uploaded by the client, I want to kick off an event that ftp's that file via regular FTP to my Windows cloud.
These files can be up to 10mb so the even that ftp's to the other server can't fire until the file is completely uploaded.
Has anyone set something like this up? Any guidance would be appreciated.
Thanks!
In Linux, you can use incron to monitor the directory the files will be SFTP'd to and have it trigger your ftp job. It's kind of like cron except that instead of triggering jobs based on time, it does so based on filesystem modifications. In order to only trigger once the entire file has been written, I think you can use IN_CLOSE_WRITE in the inotify mask. Failing this, I suggest configuring events for each of the events individually to echo a message to a log file and see if you can identify one which reliably happens only at the end of the SFTP transfer.
If you're using RedHat, it's not in the standard distribution, but it is in EPEL.
On Windows you could use Titan FTP Server Enterprise Edition, which supports SFTP as well as allows you to define various types of events. When the event is triggered, you could kick off anything you need on a per folder/per account basis.
PS. AFAIK, when it comes to SFTP it is either password authentication or public key authentication (SSH key), but not both.
In your UNIX server, you can configure SSH to use a custom sftp server that instead of handling SFTP protocol itself, opens a new SSH connection to to the Windows SFTP server using password authentication and forwards the SFTP traffic there.
Writting the proxy is easy with the right tools, for instance, in Perl using the Net::OpenSSH module:
#!/usr/bin/perl
# this is the sftp-proxy-server
use Net::OpenSSH;
my $ssh = Net::OpenSSH->new($windows_server, $user, $passwd);
$ssh->system({ssh_opts => '-s'}, 'sftp');
$ssh->error and die $ssh->error;
You can instruct the SSH server to use that alternative SFTP server changing the configuration in /etc/ssh/sshd_config. For instance:
Subsystem sftp /usr/local/bin/sftp-proxy-server
Did you try apache FTP Serveur ?
I think you can do what you need with the ftplet API.
see :
http://mina.apache.org/ftpserver-project/index.html

Resources